我剛剛搭建好了vue-cli的結構
這個頁面已經出來了,如果我想往下繼續加入幾個元件應該怎麼編輯,自己對router還不是特別熟,求指教
PHP中文网2017-05-16 13:45:56
使用vue-router設定路由 在vue根實例中註入
import Vue from 'vue'
import VueRouter from 'vue-router'
import topNav from '../components/topNav'
import mine from '../components/mine'
import searchPage from '../components/searchPage'
import searchResult from '../components/searchResult'
import playPage from '../components/playPage'
import playbottom from '../components/playbottom'
import latestPlay from '../components/latestPlay'
Vue.use(VueRouter)
const router = new VueRouter({
routes: [
{
path: '/',
component: mine
},
{
path: '/mine',
component: mine
},
{
path: '/mine/searchPage',
component: searchPage
},
{
path: '/mine/searchPage/searchResult',
component: searchResult
},
{
path: '/playPage',
component: playPage
},
{
path: '/latestPlay',
component: latestPlay
}
]
})
export default router
import router from '../router'
var app = new Vue({
el: "#app1",
router,
store: vuex_store,
})
大概就是這樣 連結用
建議還是透過文件學習