1 mounted () { 2 history.pushState(null, null, document.URL); 3 window.addEventListener('popstate', function () { 4 history.pushState(null, null, document.URL); 5 }); 6 },
若使用的框架是vant-ui ,且弹窗使用的是组件中的van-dialog,禁用手机系统返回按钮作用可使用如下属性:
1 <van-dialog :close-on-popstate ="false" > </van-dialog> 2// close-on-popstate 是否在页面回退时自动关闭 默认是true
