4、vue路由的配置

index.html


  
    
    shell
    
    
  
  
    
man.js

import Vue from 'vue';
import App from './App';
import VueRouter from 'vue-router';
import Goods from './components/goods/Goods';
import Seller from './components/seller/Seller';
import Ratings from './components/star/Ratings';

Vue.config.productionTip = false;
Vue.use(VueRouter);

const routes = [
 { path: '/goods', component: Goods },
 { path: '/seller', component: Seller },
 { path: '/ratings', component: Ratings }
];

const router = new VueRouter({
  routes
});
/* eslint-disable no-new */
new Vue({
  router,
  render: h => h(App)
}).$mount('#app');
App.vue






路由官网
https://router.vuejs.org/zh-cn/essentials/getting-started.html

你可能感兴趣的:(4、vue路由的配置)