問題一: 去除vue訪問路徑下的 #
mode: 'history',
問題二:當(dāng)項目訪問路徑不存在的時候,跳轉(zhuǎn)404界面
{ path: '*', component: P404 }
完整的router 配置
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import P404 from '@/components/404/404'
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
{
path: '/',
name: 'HelloWorld',
component: HelloWorld
},
{ path: '*', component: P404 }
]
})