diff --git a/src/router/index.ts b/src/router/index.ts index bb2296e..cd847cf 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -17,8 +17,9 @@ getRouteNames(basicRoutes); // 创建一个可以被 Vue 应用程序使用的路由实例 export const router = createRouter({ // 创建一个 hash 历史记录。 - history: createWebHashHistory(import.meta.env.VITE_PUBLIC_PATH), - //history: createWebHistory(import.meta.env.VITE_PUBLIC_PATH), + history: import.meta.env.VITE_ROUTE_MODE=='history'? + createWebHistory(import.meta.env.VITE_PUBLIC_PATH) + :createWebHashHistory(import.meta.env.VITE_PUBLIC_PATH), // 应该添加到路由的初始路由列表。 routes: basicRoutes as unknown as RouteRecordRaw[], // 是否应该禁止尾部斜杠。默认为假 diff --git a/src/views/secondDev/formCreatePage.vue b/src/views/secondDev/formCreatePage.vue index 6cb9bc3..296c9b4 100644 --- a/src/views/secondDev/formCreatePage.vue +++ b/src/views/secondDev/formCreatePage.vue @@ -48,7 +48,7 @@ const formId = ref(currentRoute.value?.params?.id); const { notification } = useMessage(); const { t } = useI18n(); -const hash = location.hash; +const hash = location.hash||location.pathname; const mode = ref('read'); if (hash.indexOf('createForm') > 0) { mode.value = 'create'; diff --git a/src/views/secondDev/processTasksPage.vue b/src/views/secondDev/processTasksPage.vue index 9eea0c4..12dd489 100644 --- a/src/views/secondDev/processTasksPage.vue +++ b/src/views/secondDev/processTasksPage.vue @@ -95,7 +95,7 @@ const selectedKeys = ref(['ToDoTasks']); const query = unref(currentRoute).query; let id = 'ToDoTasks'; - const lHash = location.hash; + const lHash = location.hash||location.pathname; if (lHash.indexOf('/draft') > 0) { id = 'Drafts'; } else if (lHash.indexOf('/myProcess') > 0) { diff --git a/types/global.d.ts b/types/global.d.ts index 049ef55..0084c6d 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -61,6 +61,7 @@ declare global { VITE_USE_MOCK: boolean; VITE_USE_PWA: boolean; VITE_PUBLIC_PATH: string; + VITE_ROUTE_MODE:string; VITE_PROXY: [string, string][]; VITE_GLOB_APP_TITLE: string; VITE_GLOB_APP_SHORT_NAME: string;