jQuery MiniUI

标题: mini.extend扩展mini.panel控件如何给取消默认帮定事件 [打印本页]

作者: Aisin丿Gioro    时间: 2020-3-13 15:32:40     标题: mini.extend扩展mini.panel控件如何给取消默认帮定事件

  1. mini.extend(seesoft.Panel, mini.Panel, {
  2.     uiCls: 'basic-panel',
  3.     initComponents: function () {
  4.         var footer = '<div>'
  5.             + '<a name="ok" class="mini-button mini-button-primary" style="margin-right: 10px;">确定</a>'
  6.             + ' <a name="cancel" class="mini-button">取消</a>'
  7.             + '</div>';
  8.         this.set({
  9.             style: "width: 100%;height:100%",
  10.             borderStyle: "border: 0;",
  11.             showHeader: false,
  12.             showToolbar: false,
  13.             showFooter: true,
  14.             footer: footer
  15.         });
  16.     },
  17.     bindEvents: function () {
  18.         this.okBtn = mini.getbyName('ok', this);
  19.         this.cancelBtn = mini.getbyName('cancel', this);

  20.         var that = this;

  21.         this.okBtn.on('click', function (e) {
  22.             that.fire("okclick");
  23.         });
  24.         this.cancelBtn.on('click', function (e) {
  25.             that.fire("cancelclick");
  26.         });
  27.     },
  28.     getAttrs: function (el) {
  29.         var attrs = seesoft.Panel.superclass.getAttrs.call(this, el);
  30.         mini._ParseString(el, attrs, ["onokclick", "oncancelclick"]);
  31.         return attrs;
  32.     }
  33. });
复制代码
弹出框的取消按钮如何默认绑定一个关闭窗口的事件,如果页面给panel设置onCancelclick的话就使用页面的事件

作者: felt    时间: 2020-3-16 10:12:59

不太理解你的意思
请带简单例子重现问题
作者: Aisin丿Gioro    时间: 2020-3-16 15:10:02

本帖最后由 Aisin丿Gioro 于 2020-3-16 15:14 编辑
felt 发表于 2020-3-16 10:12
不太理解你的意思
请带简单例子重现问题
[attach]12744[/attach]
我是想扩展panel控件,主要是方便快速在子页面搭建panel,封装好以后就不用写footer了,给footer的取消按钮默认绑定一个关闭父页面mini.open的方法closeWindow,如果取消按钮需要绑定其他事件,就写oncancelclick
[attach]12745[/attach]

作者: felt    时间: 2020-3-16 17:26:50

Aisin丿Gioro 发表于 2020-3-16 15:10
我是想扩展panel控件,主要是方便快速在子页面搭建panel,封装好以后就不用写footer了,给footer的取消按 ...
  1. this.cancelBtn.on('click', function (e) {
  2.             var ex = {cancel:false};
  3.             that.fire("cancelclick", ex);
  4.             if (ex.cancel == true) {
  5.                 alert(1);   
  6.             } else {
  7.                 alert("2");
  8.             }
  9.         });
复制代码





欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2