gjc_yappy 发表于 2024-1-31 09:19:50

dialog报错

//打开一个对话框,使用html作为内容var _self = this;var dlg = this.form.dialog({"title": "填写内容","width": "500","height": "300","html": "<div>内容:</div><div><input type='text'></div>","ok": function(){      var value = this.node.getElement("input").value; //this指向对话框对象      if( !value ){          _self.form.notice("请填写内容", "info");          return false; //返回false不关闭对话框      }else{          return true; //返回true关闭对话框      }}});我参照文档中的这段代码,直接复制到一个按钮的click事件中,爆出如下错误,软件版本是7.0.5VM2322:19TypeError: this.form.dialog is not a function    at MWF.Macro.scriptSpace.f_0 (<anonymous>:4:21)    at Object.exec (<anonymous>:1:568)    at Object.exec (<anonymous>:1:2826)    at i.extend.$owner (mootools-1.6.0_all.js:1399:1)    at Object.runCustomAction (<anonymous>:1:63231)    at i.extend.$owner (mootools-1.6.0_all.js:1399:1)    at Object._buttonClick (<anonymous>:1:6094)    at i.extend.$owner (mootools-1.6.0_all.js:1399:1)    at HTMLDivElement.a (mootools-1.6.0_all.js:4604:1)

xadmin 发表于 2024-2-1 10:04:20

您这个版本太旧了,this.form中还没有内置dialog方法。
您可以用这种方式
    var dlg = o2.DL.open({

      "title": "弹出框",
      "width": "200px",
      "height" : "300px",
      "mask": true,
      "content": new Element("div",{"text":"哈哈哈"}),
      "container": this.page.getApp().node,
      "positionNode": this.form.getApp().content,
      "onQueryClose": function(){
            
      }.bind(this),
      "buttonList": [
            {
                "text": "关闭",
                "action": function(){
                  dlg.close();
                }.bind(this)
            }   
      ],
      "onPostShow": function(){

            dlg.reCenter();
      }.bind(this)
    });

gjc_yappy 发表于 2024-2-19 11:02:36

xadmin 发表于 2024-2-1 10:04
您这个版本太旧了,this.form中还没有内置dialog方法。
您可以用这种方式
    var dlg = o2.DL.open({


好的,谢谢老师,我去试一下:handshake
页: [1]
查看完整版本: dialog报错