Vue 路由文檔地址 https://router.vuejs.org/
用 Vue.js + vue-router 創建單頁應用,是非常簡單的。使用 Vue.js ,我們已經可以通過組合組件來組成應用程序,當你要把 vue-router 添加進來,我們需要做的是,將組件(components)映射到路由(routes),然后告訴 vue-router 在哪里渲染它們。下面是
個基本例子:
首先創建兩個組件 。
2.然后在router index里面定義路由
3.使用router-link做跳轉
GitHub地址https://github.com/WilliamZia/Vue-mall.git