自定义表单JS片段 - 根据下拉框值的改变,当选定某个值时,PC端和移动端要弹出框提示

446 阅读1分钟
AttachXFormValueChangeEventById("控件ID",function(){
   var  notifyLevel = GetXFormFieldValueById("控件ID");
   if(navigator.platform.indexOf("Win32") != -1){//判断为PC端
       seajs.use(['lui/dialog'],function(dialog){
           if(notifyLevel=='4' || notifyLevel=='5'){
                dialog.alert("提示语!");
            }
        });
    }else{//如果非PC端
        require(['mui/dialog/Tip'],function(Tip){
            if(notifyLevel=='4' || notifyLevel=='5'){
                Tip.tip({text:'提示语!'});
            }
        });
    }
});