vue hash模式下页面跳转用this.$router.push({ path: ‘/‘ })
程序员文章站
2022-03-29 09:14:02
...
hash模式下:mode: ‘hash’,
export default new Router({
mode: 'hash',
routes: [
{
path: '/',
name: 'home',
component: Home
}
]
})
页面点击用window.location.href = "./"无效
正确:
clickBtn() {
this.$router.push({ path: '/' })
this.$router.push({ path: '/', query: { id: row.id } }) // 带参数
}