写法 1:将函数存入变量内,子类页面调用
父页面 var _tools = { //方法1 refresh:function(){ layui.table.reload('dg',{ where : layui.$.form.val('fm'), page : { curr : 1 } }); }, //方法2 refreshTree :function (){ console.log(2); } } window.tools = _tools;
parent.tools.refresh();//子页面直接调用即可 parent.tools.refreshTree();
写法2:子类页面点击父页面按钮触发方法
parent.layui.$('#refresh').click();