vue路由的使用

//配置路由
Vue.use(Router)

export default new Router({
  routes: [{
      path: '/',
      name: 'Home',
      component: Home
    },{
      path: '/city',
      name: 'City',
      component: City
    }]
})

  

//在子组件中使用路由
<router-link to="/city"> //to="/city"  路由的去向
<div class="head-right"> {{this.city}} <span class="iconfont arror-icon">�</span> </div> </router-link>

  

//js路由跳转

this.$router.push('/City')

  

原文地址:https://www.cnblogs.com/chenlw/p/9718933.html