this.$router.push({
name: 'Login', params: {to: 'InnovateProject'}
})
name:你要去的页面,在router里面要设置name
to:传的值(到另外一个页面接受时就只接受to)
如:
this.$route.params.to
这就另外一个页面是接受
路由跳转直接在@click后面写的话不要加this 直接写$router.push({})
skipPc () {
let skipPc = document.getElementById('skipPc')
skipPc.href = 'https://8bihui.com/FrequentlyAskedQuestion/' + this.selectLeftType + '/' + this.leftCategotyId + '/' + this.threeId
skipPc.click()
}
也可以把跳转写成一个函数封装起来
跳转到另外的页面时要是没存的话刷新页面传来的值会消失,解决方法在url上加上你传的值,在router文件夹里面的index.js里面,把要跳转到的页面路径后加上你要传的值。如:
path: '/FrequentlyAskedQuestion/:to'
这样就解决了,而且当没值传来时自动跳首页