1、二次开发的页面不用知道是点击的哪个按钮
需要关注的仅仅是,是否需要继续保存
!function(){
page.event.on(PageEvent.LOADED,function(args){
//此处编写扩展代码
page.event.on(PageEvent.SAVEBEFORE, function (obj,def) {
if( $('#regnum').html() == $('#code').val() ){
// 继续保存
def.resolve();
}else{
// 不执行保存操作
def.reject();
}
})
});
}();
2、多个窗口(iframe)层级为二级时
点击二级窗口‘确认按钮’,关闭当前窗口,刷新上一级窗口
page.getControl("confirmBtnBar").event.on("buttonbar_click", function (button) {
//关闭当前窗口
window.page.close();
//刷新上一级窗口
var src = $(top.document).find(".layui-layer-content iframe").attr('src')
$(top.document).find(".layui-layer-content iframe").attr('src',src)
const phone = page.getControl('phone').value;
const code = page.getControl('code').value;
const codeValidResult = confirmFunction.validCode(code);
if (codeValidResult.state) {
confirmFunction.click({code: code, phone: phone});
} else {
dsf.layer.message(codeValidResult.msg, false);
}
});