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