vue-router中注意单词

来源:互联网 发布:不错吧源码 编辑:程序博客网 时间:2024/06/08 01:23

router
英 [‘ruːtə(r)] 美 [‘rʊtɚ]
n. [计] 路由器;刳刨者
route
英 [ruːt] 美 [raʊt]
vt. 按某路线发送
n. 路线;航线;通道
routes
多n. [计] 路由,[通信] 路径;[交] 线路,复数
一定要分清楚意思,不要粗心写错了

this.$route.params.id
const routes = [{ path: '/', component: Home },             {path: '*', component: Errorpage404}]

注册路由

import VueRouter from 'vue-router'const router = new VueRouter({  mode: 'history',  routes})new Vue({  router,  store}).$mount('#app')