vue路由配置:
https://router.vuejs.org/
1.安装
npm install vue-router --save / cnpm install vue-router --save
2、引入并 Vue.use(VueRouter) (main.js)
import VueRouter from 'vue-router'
Vue.use(VueRouter)
3、配置路由
1、创建组件 引入组件
2、定义路由
const routes = [
{
path: '/foo', component: Foo },
{
path: '/bar', component: Bar },
{
path: '*', redirect: '/home' } /*默认跳转路由*/