新手遇到的问题:Easy UI的对话框老是在页面加载完成后自动弹出

由于是第一次接触Easy UI,还不是非常熟悉,尝试了一下对话框功能,还是很不错的,但问题是页面加载完成后,所有的对话框都自动弹出来了,百度了好久,也没有具体说明白的,貌似别人都没有这个问题哦


以下是Easy UI 官方提供的示例(页面加载完成后对话框自动弹出)


<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Basic Dialog - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="./jquery-easyui-1.4/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="./jquery-easyui-1.4/themes/icon.css">
 
    <script type="text/javascript" src="./jquery-easyui-1.4/jquery.min.js"></script>
    <script type="text/javascript" src="./jquery-easyui-1.4/jquery.easyui.min.js"></script>
</head>
<body>
    <h2>Basic Dialog</h2>
    <p>Click below button to open or close dialog.</p>
    <div style="margin:20px 0;">
        <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="$('#dlg').dialog('open')">Open</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="$('#dlg').dialog('close')">Close</a>
    </div>
    <div id="dlg" class="easyui-dialog" title="Basic Dialog" data-options="iconCls:'icon-save'" style="width:400px;height:200px;padding:10px">
        The dialog content.
    </div>
</body>
</html>

以下是Easy UI 官方文档介绍的Dialog的属性(但其中并没有关于状态的信息)



但在该示例中却添加一个closed属性


于是我在自己的示例代码中也加入了该属性

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Basic Dialog - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="./jquery-easyui-1.4/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="./jquery-easyui-1.4/themes/icon.css">
 
    <script type="text/javascript" src="./jquery-easyui-1.4/jquery.min.js"></script>
    <script type="text/javascript" src="./jquery-easyui-1.4/jquery.easyui.min.js"></script>
</head>
<body>
    <h2>Basic Dialog</h2>
    <p>Click below button to open or close dialog.</p>
    <div style="margin:20px 0;">
        <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="$('#dlg').dialog('open')">Open</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" οnclick="$('#dlg').dialog('close')">Close</a>
    </div>
    <div id="dlg" class="easyui-dialog" title="Basic Dialog" data-options="iconCls:'icon-save',closed:true" style="width:400px;height:200px;padding:10px">
        The dialog content.
    </div>
</body>
</html>

果然解决了刚才遇到的问题,后来才发现,原来closed属性是在window中定义的,而dialog是window的一种扩展,自然也包含这个属性。

The properties extend from window, below is the overridden properties for dialog.



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值