- 注册时间
- 2017-5-24
- 最后登录
- 1970-1-1
- 阅读权限
- 10
- 积分
- 69
- 精华
- 0
- 帖子
- 20

|
//快速弹窗 路径 数据 必填
//ondestroy:回调函数 请手动写入 规范 ondestroy(action)
//allowDrag:允许拖拽
function openPage(url, title, data, ondestroy, width, height, allowDrag) {//打开页面
if (!url || !data) return alert('函数调用有误!请联系开发人员进行修改~', 'sT');
mini.open({
url: url,
title: (title ? title : "新窗口"),
width: (width ? width : 600),
height: (height ? height : 550),
onload: function () {
var iframe = this.getIFrameEl();
iframe.contentWindow.SetData(data);
//加载成功时讲父页面存到 top对象
//使用title应对 父页面打开子页面 子页面再用此方法打开子页面 就会覆盖改对象
//缺点是title相同会引发问题
top[iframe.contentDocument.title] = window;
},
ondestroy: function (action) {//此为miniui内定义的回调
top[this.getIFrameEl().contentDocument.title] = null;//子页面关闭时将父页面win对象销毁
if (ondestroy) {//讲此方法的调用者变为this
this.ondestroy = ondestroy;//此为传递的回调函数
this.ondestroy(action);//使调用者变成页面
}
else if (typeof (grid) != "undefined") grid.reload();//如果有grid对象 回调时刷新它
},
allowDrag: (typeof allowDrag != "undefined" ? allowDrag : true)
});
}
我在boot里面封装了这样的open事件方法,所以希望能够改造一下,不想放弃使用这个封装,如果监听页面元素的点击然后再改变页面大小感觉就要写很多代码了。想知道有没有简易的解决之道呢?! |
|