You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
670 B
34 lines
670 B
import Vue from 'vue'
|
|
import VueRouter from 'vue-router'
|
|
import withmind from '../views/withmind/index.vue'
|
|
|
|
Vue.use(VueRouter)
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
redirect: "/withmind"
|
|
},
|
|
{
|
|
path: '/withmind',
|
|
name: 'withmind',
|
|
component: withmind
|
|
}
|
|
]
|
|
|
|
const router = new VueRouter({
|
|
mode: 'hash',
|
|
base: process.env.BASE_URL,
|
|
routes,
|
|
// 每次进入路由(包括刷新页面)都滚到顶部
|
|
scrollBehavior(to, from, savedPosition) {
|
|
if (savedPosition) {
|
|
// 浏览器前进/后退 → 恢复原位置
|
|
return savedPosition
|
|
}
|
|
// 否则(包括刷新)滚到顶部
|
|
return { top: 0 }
|
|
}
|
|
})
|
|
|
|
export default router
|
|
|