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