Fork me on GitHub

v-router路由

资料

// 这是必须要有的,不是会报错 
 Vue.use(VueRouter);
  const routes = [
    // 首页重定向goods组件
    { path: '/', redirect: 'goods' },
    { path: '/goods', component: goods },
    { path: '/ratings', component: ratings }
  ];
  const router = new VueRouter({
    routes // (缩写)相当于 routes: routes
  });

// 把router放到vue即可

const app = new Vue({
  router
}).$mount('#app')

 

posted @ 2017-12-03 22:08  小数点就是问题  阅读(162)  评论(0编辑  收藏  举报