vue project this. $router. go (- 1) can‘t goback
Posted SuperAnt_me
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue project this. $router. go (- 1) can‘t goback相关的知识,希望对你有一定的参考价值。
In the Vue project, hash route ‘this. $router. go (- 1)’ is used, and click button the url ‘#’ before has a ‘?’ & Causes the previous page to fail , double click It will take effect but url err
this origin url
http://localhost/payment/#/certification/detail
if i click goback the url change
http://localhost/payment/?#/certification/detail
my code
//button
<button class="btn back p-cu-p" @click="goback">GoBack</button>
//function
goback () {
this.$router.go(-1)
},
//route
{
path: '/certification',
name: 'CertifictionIndex',
component: () => import('@/views/CustomerManagement/certificationIndex.vue'),
children: [
{
path: '/',
name: 'Certifiction',
component: () => import('@/views/CustomerManagement/certification.vue'),
},
{
path: 'detail',
name: 'CertifictionDetail',
component: () => import('@/views/CustomerManagement/certificationDetail.vue'),
},
],
}
以上是关于vue project this. $router. go (- 1) can‘t goback的主要内容,如果未能解决你的问题,请参考以下文章
vue 带参数跳转打开新窗口 $router.resolve 参数不在url中
vue 组件无法从 vue-router 获取 this.$router
Vue-Router 源码解析 Vue内this.$router和this.$route的区别