Vue H5安卓的返回键解决方案
使用Vue和H5做安卓手机端时候,安卓的实体返回键会返回上一个路由页面,导致页面出现各种问题。
一、路由跳转页面改写
在组件中,有需要跳转页面,并且不让用户返回的情况,例如:支付、登录、注销等。请做一下修改:
1、this.$router.push()全部改写为this.$router.replace()
2、<router-link to="/">全部改写为<router-link to="/" replace>
因为this.router.replace不会在history中保留。