代码完成后 请重启项目 一定要重启! 重启!重启! (没重启项目不生效)
1.找到项目中的路由文件
2.引用vueRouter
// vue3
import { createRouter, createWebHistory } from "vue-router";
var router = createRouter({
mode: 'history',
history: createWebHistory(),
routes: [{
path: '/Login',
name: 'Login',
component: () => import('../views/login/Login.vue')
}]
})
//vue2
import { createRouter, createWebHashHistory } from "vue-router";
var router = createRouter({
mode: 'history',
history: createWebHashHistory(),
routes: [{
path: '/Login',
name: 'Login',
component: () => import('../views/login/Login.vue')
}]
})