const routes = [{
path: “/”,
redirect: “/index”
},
]
const router = new VueRouter({
routes,
mode: ‘history’,
//回到顶部
scrollBehavior: () => ({
y: 0
})
})
这里的必须是routes,而不是routers,如果是routers将无法显示路由中的内容
const routes = [{
path: “/”,
redirect: “/index”
},
]
const router = new VueRouter({
routes,
mode: ‘history’,
//回到顶部
scrollBehavior: () => ({
y: 0
})
})
这里的必须是routes,而不是routers,如果是routers将无法显示路由中的内容