查看: 2532|回复: 2

dialog报错

升级   5.29%

35

主题

79

回帖

529

积分

注册会员

Rank: 2

积分
529
发表于 2024-1-31 09:19:50 | 显示全部楼层 |阅读模式
//打开一个对话框,使用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:19  TypeError: 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)
回复

使用道具 举报

升级   100%

3

主题

1687

回帖

1018

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1018
发表于 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)
    });
回复

使用道具 举报

升级   5.29%

35

主题

79

回帖

529

积分

注册会员

Rank: 2

积分
529
发表于 2024-2-19 11:02:36 | 显示全部楼层
xadmin 发表于 2024-2-1 10:04
您这个版本太旧了,this.form中还没有内置dialog方法。
您可以用这种方式
    var dlg = o2.DL.open({

好的,谢谢老师,我去试一下
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系客服 关注微信 下载APP 返回顶部 返回列表
viewthread