use createWebHistory
This commit is contained in:
parent
a07fad8e28
commit
23308985d5
1
auto-imports.d.ts
vendored
1
auto-imports.d.ts
vendored
@ -3,5 +3,4 @@ export {}
|
|||||||
declare global {
|
declare global {
|
||||||
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
||||||
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
|
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
|
||||||
const ElNotification: typeof import('element-plus/es')['ElNotification']
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { markRaw } from 'vue';
|
import { markRaw } from 'vue';
|
||||||
import { createRouter, createWebHashHistory } from 'vue-router'; // createWebHashHistory, createWebHistory
|
import { createRouter, createWebHistory } from 'vue-router'; // createWebHashHistory, createWebHistory
|
||||||
import type { Router, RouteRecordRaw, RouteComponent } from 'vue-router';
|
import type { Router, RouteRecordRaw, RouteComponent } from 'vue-router';
|
||||||
import { Help as IconHelp } from '@element-plus/icons-vue';
|
import { Help as IconHelp } from '@element-plus/icons-vue';
|
||||||
|
|
||||||
@ -393,11 +393,13 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
|||||||
{ path: '/:pathMatch(.*)*', redirect: '/404', meta: { hidden: true }}
|
{ path: '/:pathMatch(.*)*', redirect: '/404', meta: { hidden: true }}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
console.log('BASE_URL=', import.meta.env);
|
||||||
|
|
||||||
const createTheRouter = ():Router => createRouter({
|
const createTheRouter = ():Router => createRouter({
|
||||||
history: createWebHashHistory(import.meta.env.BASE_URL),
|
// history: createWebHashHistory(import.meta.env.BASE_URL),
|
||||||
// 注意,如果要配置 HTML5 模式,则需要修改nginx配置,参考资料:
|
// 注意,如果要配置 HTML5 模式,则需要修改nginx配置,参考资料:
|
||||||
// https://router.vuejs.org/zh/guide/essentials/history-mode.html
|
// https://router.vuejs.org/zh/guide/essentials/history-mode.html
|
||||||
// history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
scrollBehavior: () => ({ top: 0 }),
|
scrollBehavior: () => ({ top: 0 }),
|
||||||
routes: constantRoutes
|
routes: constantRoutes
|
||||||
});
|
});
|
||||||
|
@ -20,7 +20,7 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
const prodMock = true;
|
const prodMock = true;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: './', // 注意,必须以"/"结尾
|
base: '/', // 注意,必须以"/"结尾,BASE_URL配置
|
||||||
define: {
|
define: {
|
||||||
'process.env': env
|
'process.env': env
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user