• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

cynchanpin

  • 博客园
  • 联系
  • 订阅
  • 管理

View Post

新手遇到的问题: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" onclick="$('#dlg').dialog('open')">Open</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#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" onclick="$('#dlg').dialog('open')">Open</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#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.



posted on 2017-04-23 08:31  cynchanpin  阅读(866)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3