1、安裝路由:
vue ui
cnpm install vue-router
2、使用,導入:
默認創建項目的時候就已經幫你寫好了。
import router from "vue-router"
Vue.use(router)
路由配置:
new router({
路由配置,決定什么路徑,顯示什么內容。
routes [{
path:路徑
componet:組件
}]
})
視圖上顯示的標簽:使用router-view決定,
頁面跳轉可以更改location.hash值,也可以使用a標簽來進行跳轉。
也可以使用router-link標簽來進行跳轉,<router-link to:"/路徑"></router-link>
也可以使用router-push來進行跳轉
自動化學習。