vue-router 路由创建(饿了么app中tab创建)【vue2.0版本以上】

项目结构:
微信截图_20181204101247.png

App.vue:






main.js:

import Vue from 'vue'
import App from './App'
import router from './router'
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: ''
})

index.js:

import Vue from 'vue'
import Router from 'vue-router'
import goods from '../components/goods/goods.vue'
import ratings from '../components/ratings/ratings.vue'
import seller from '../components/seller/seller.vue'
Vue.use(Router)
export default new Router({
  routes: [
//重定向 redirect
    {
      path:'/',
      redirect:'/goods'
     },
    {
     path:'/goods',
     name:'goods',
     component:goods
    },
    {
      path:'/seller',
      name:'seller',
      component:seller
     },
     {
      path:'/ratings',
      name:'ratings',
      component:ratings
     }
  ]
})

goods.vue,seller.vue,ratings.vue






你可能感兴趣的:(vue-router 路由创建(饿了么app中tab创建)【vue2.0版本以上】)