//配置路由
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')

  

posted on 2018-09-28 15:34  chenlw101  阅读(186)  评论(0编辑  收藏  举报