创建一个Router.js文件
// 路由请求//声明一个常量设置路菜单// import Vue from "vue/types/index";import Vue from 'vue'import VueRouter from 'vue-router'Vue.use(VueRouter)const First={template:'<div>菜单一</div>'}const Second={template:'<div>菜单二</div>'}const Home={template:'<div>菜单三</div>'}const router=new VueRouter({ mode:'history', //模式 base:__dirname, //base可选参数指当前路径 routes:[ {path:'/',component:First}, {path:'/First',component:Second}, {path:'/Second',component:Home} ]})找到入口文件编辑Router.js引入
import Vue from 'vue'import Router from './Router'
来源:https://www.cnblogs.com/longly/p/9136388.html