Vue2.0 简单路由跳转(二)

 

重大福利

 

阿里云服务器优惠  https://www.aliyun.com/1111/home?userCode=n9v6urcn

 

 

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

posted @ 2017-06-06 21:17  晚秋、  阅读(22244)  评论(2)    收藏  举报