使用VueRouter(SPA頁面)
1.import VueRouter from 'vue-router'
2.Vue.use(VueRouter);
3.創建路由
export default new VueRouter({
routes: [
{
path: '',
name: '',
component: ''
}
],
linkActiveClass: 'active',
linkExactActiveClass: 'currentActive',
mode: 'history',
});
4.在組件中使用
import router from './router/index'
<router-view />
5.將路由對象注入到Vue實例中
6.重啟服務器
文章標籤
全站熱搜
留言列表