剛開始學習Vue路由時,老是不知道<router-view />標簽放哪里,很難受,慢慢使用很久后,才弄明白,記住一句話:將此釘子(<router-view />)埋於他路徑的上一級模板內即可
如:
{ path: "/one", name: "one", component: one, children: [ { path: "two", component: two, children:[ { path:"three", component:three } ] } ] }
上述例子中
第一級路由(/one),需要將<router-view />標簽放在app.vue里
第二級路由(/one/two),需要將<router-view />標簽放在one.vue里
第三級路由(/one/two/three),需要將<router-view />標簽放在two.vue里
