feat: upgrade to vue 3.4 and fix route issues (#699)

* feat: 升级Vue3.4,修复Route调用方式造成一系列问题

* fix: 修复编译问题
This commit is contained in:
悠静萝莉 2024-03-30 22:32:05 +08:00 committed by GitHub
parent 0f7096a167
commit 13505fdedc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 6 deletions

View File

@ -32,11 +32,11 @@
"qrcode.vue": "^3.4.1",
"qs": "^6.11.2",
"tdesign-icons-vue-next": "^0.2.2",
"tdesign-vue-next": "^1.8.1",
"tdesign-vue-next": "^1.9.3",
"tvision-color": "^1.6.0",
"vue": "~3.3.8",
"vue": "~3.4.21",
"vue-i18n": "^9.9.1",
"vue-router": "~4.2.5"
"vue-router": "~4.3.0"
},
"devDependencies": {
"@commitlint/cli": "^18.6.0",

View File

@ -31,7 +31,7 @@
:header-affixed-top="headerAffixedTop"
@page-change="rehandlePageChange"
@change="rehandleChange"
@select-change="(value) => rehandleSelectChange(value as number[])"
@select-change="(value: number[]) => rehandleSelectChange(value)"
>
<template #status="{ row }">
<t-tag v-if="row.status === CONTRACT_STATUS.FAIL" theme="danger" variant="light">

View File

@ -1,5 +1,5 @@
import uniq from 'lodash/uniq';
import { createRouter, createWebHistory, RouteRecordRaw, useRoute } from 'vue-router';
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
const env = import.meta.env.MODE || 'development';
@ -59,7 +59,8 @@ export const getRoutesExpanded = () => {
};
export const getActive = (maxLevel = 3): string => {
const route = useRoute();
// 非组件内调用必须通过Router实例获取当前路由
const route = router.currentRoute.value;
if (!route.path) {
return '';

View File

@ -4,6 +4,7 @@
"module": "esnext",
"moduleResolution": "node",
"jsx": "preserve",
"jsxImportSource": "vue",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,