layer.prompt 输入值为空的时候点击confirm不能继续

弹出框不输入任何字符的情况下点击confirm不能继续

Code:

layer.prompt({title: 'PopUp', formType: 2,area: ['500px', '100px'],btn: ['Confirm','Cancel'],maxlength:600 }, function(reason, index){
                        layer.close(index);
                        GroupM_LoadingShow();
                        alert(reason);  
                    });

layer.prompt也是继承layer.open的,如果直接用原方法yes就可以了

layer.prompt({
                        title: 'Comments', formType: 2, area: ['500px', '100px'], btn: ['Confirm', 'Cancel'], maxlength: 600,
                        yes: function (index, commentsInput){
                            layer.close(index);
                            GroupM_LoadingShow();
                            alert(commentsInput.find(".layui-layer-input").val())
                            }});

注意两种用法的function的参数格式不一样。

原文地址:https://www.cnblogs.com/michelledawm/p/10516745.html