Add event listener in the parent page:
window.addEventListener('refresh', function(e) {
chaxun();//执行刷新方法
});
When the subpage is initialized, register the beforeback method:
mui.init({
beforeback: function() {
//获得父页面的webview
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
mui.fire(list, 'refresh');
//返回true,继续页面关闭逻辑
return true;
}
});
After adding the above methods in the two interfaces. Use mui.back() anywhere in the sub-interface; you can achieve the effect