mui "确定要离开当前页面吗?", "温馨提示", ["取消", "确定"]

文档:http://dev.dcloud.net.cn/mui/ui/#accordion
mui-col-xs-9

window.addEventListener('popstate', function (e) {  //popstate 该事件在窗口的浏览历史(history 对象)发生改变时触发。
            mui.confirm("确定要离开当前页面吗?", "温馨提示", ["取消", "确定"], function (e) {
                if (e.index == 1) {
                    window.history.go(-1);
                } else {
                    history.pushState(null, null, document.URL);
                }
            });
        });

猜你喜欢

转载自blog.csdn.net/fengtingYan/article/details/84588658