Compare commits

..

12 Commits

Author SHA1 Message Date
xiaoxian521
185d779c8d release: update 3.4.5 2022-08-22 20:21:53 +08:00
xiaoxian521
241fc618b8 fix: 修复本地响应式存储对象设置问题 2022-08-22 20:17:50 +08:00
xiaoxian521
3a0b2e04d4 release: update 3.4.0 2022-08-22 17:21:18 +08:00
xiaoxian521
cec867297d chore: update 2022-08-22 16:16:17 +08:00
RealityBoy
cbe539c727 Refactor/tags (#332)
* refactor: tags

* chore: update

* chore: update

* chore: update

* chore: update
2022-08-22 15:49:29 +08:00
xiaoxian521
7c84d9eb70 perf: router 2022-08-22 10:19:10 +08:00
xiaoxian521
5a7187d22f perf: 移动端优化 2022-08-21 10:49:27 +08:00
xiaoxian521
a7e8249ae6 chore: update 2022-08-21 10:26:09 +08:00
xiaoxian521
d81ab81fb0 chore: update 2022-08-21 07:31:59 +08:00
xiaoxian521
846e7350fb chore: update 2022-08-19 23:01:45 +08:00
xiaoxian521
102f27fe30 chore: update element-plus@2.2.14 and perf menu 2022-08-19 21:41:49 +08:00
newives
0e76bd4aac perf: 清空缓存并返回登录页时添加重置路由 (#329)
Co-authored-by: xiaoxian521 <1923740402@qq.com>
2022-08-19 15:56:39 +08:00
42 changed files with 717 additions and 667 deletions

View File

@@ -1,3 +1,17 @@
# 3.4.5 (2022-8-22)
### 🐞 Bug fixes
- Fix local responsive storage object setting issue
# 3.4.0 (2022-8-22)
### 🍏 Perf
- Optimized routing
- Optimized for mobile compatibility
- Optimized routing parameters (`query`, `params` way to refresh the page does not need to open the tab page cache, the parameters can be retained on the `url` and `tab page`)
# 3.3.5 (2022-8-19) # 3.3.5 (2022-8-19)
### 🎫 Feat ### 🎫 Feat

View File

@@ -1,3 +1,17 @@
# 3.4.5 (2022-8-22)
### 🐞 Bug fixes
- Fix local responsive storage object setting issue
# 3.4.0 (2022-8-22)
### 🍏 Perf
- Optimized routing
- Optimized for mobile compatibility
- Optimized routing parameters (`query`, `params` way to refresh the page does not need to open the tab page cache, the parameters can be retained on the `url` and `tab page`)
# 3.3.5 (2022-8-19) # 3.3.5 (2022-8-19)
### 🎫 Feat ### 🎫 Feat

View File

@@ -1,3 +1,17 @@
# 3.4.5 (2022-8-22)
### 🐞 Bug fixes
- 修复本地响应式存储对象设置问题
# 3.4.0 (2022-8-22)
### 🍏 Perf
- 优化路由
- 优化移动端兼容性
- 优化路由传参(`query``params` 方式刷新页面不需要再开启标签页缓存也能保留参数在`url``标签页`上)
# 3.3.5 (2022-8-19) # 3.3.5 (2022-8-19)
### 🎫 Feat ### 🎫 Feat

View File

@@ -2,9 +2,14 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="renderer" content="webkit" />
<meta
name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/>
<title>vue-pure-admin</title> <title>vue-pure-admin</title>
<link rel="icon" href="/favicon.ico" />
<script> <script>
window.process = {}; window.process = {};
</script> </script>

View File

@@ -4,8 +4,6 @@ import { MockMethod } from "vite-plugin-mock";
// http://mockjs.com/examples.html#Object // http://mockjs.com/examples.html#Object
const systemRouter = { const systemRouter = {
path: "/system", path: "/system",
name: "User",
redirect: "/system/user/index",
meta: { meta: {
icon: "setting", icon: "setting",
title: "menus.hssysManagement", title: "menus.hssysManagement",
@@ -51,8 +49,6 @@ const systemRouter = {
const permissionRouter = { const permissionRouter = {
path: "/permission", path: "/permission",
redirect: "/permission/page/index",
name: "PermissionPage",
meta: { meta: {
title: "menus.permission", title: "menus.permission",
icon: "lollipop", icon: "lollipop",
@@ -79,8 +75,6 @@ const permissionRouter = {
const frameRouter = { const frameRouter = {
path: "/iframe", path: "/iframe",
name: "FramePure",
redirect: "/iframe/pure",
meta: { meta: {
icon: "monitor", icon: "monitor",
title: "menus.hsExternalPage", title: "menus.hsExternalPage",
@@ -115,8 +109,6 @@ const frameRouter = {
const tabsRouter = { const tabsRouter = {
path: "/tabs", path: "/tabs",
redirect: "/tabs/index",
name: "Tabs",
meta: { meta: {
icon: "IF-team-icontabs", icon: "IF-team-icontabs",
title: "menus.hstabs", title: "menus.hstabs",
@@ -131,13 +123,19 @@ const tabsRouter = {
} }
}, },
{ {
path: "/tabs/detail", path: "/tabs/query-detail",
name: "TabDetail", name: "TabQueryDetail",
meta: { meta: {
title: "", // 不在menu菜单中显示
showLink: false, showLink: false
dynamicLevel: 3, }
refreshRedirect: "/tabs/index" },
{
path: "/tabs/params-detail/:id",
component: "params-detail",
name: "TabParamsDetail",
meta: {
showLink: false
} }
} }
] ]

View File

@@ -1,6 +1,6 @@
{ {
"name": "vue-pure-admin", "name": "vue-pure-admin",
"version": "3.3.5", "version": "3.4.5",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "cross-env --max_old_space_size=4096 vite", "dev": "cross-env --max_old_space_size=4096 vite",
@@ -49,7 +49,7 @@
"dayjs": "^1.11.4", "dayjs": "^1.11.4",
"driver.js": "^0.9.8", "driver.js": "^0.9.8",
"echarts": "^5.3.3", "echarts": "^5.3.3",
"element-plus": "^2.2.13", "element-plus": "^2.2.14",
"element-resize-detector": "^1.2.3", "element-resize-detector": "^1.2.3",
"js-cookie": "^3.0.1", "js-cookie": "^3.0.1",
"jsbarcode": "^3.11.5", "jsbarcode": "^3.11.5",
@@ -143,9 +143,9 @@
"stylelint-config-standard": "^24.0.0", "stylelint-config-standard": "^24.0.0",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"typescript": "^4.7.4", "typescript": "^4.7.4",
"unocss": "^0.45.8", "unocss": "^0.45.9",
"unplugin-vue-define-options": "^0.7.3", "unplugin-vue-define-options": "^0.7.3",
"vite": "^3.0.8", "vite": "^3.0.9",
"vite-plugin-mock": "^2.9.6", "vite-plugin-mock": "^2.9.6",
"vite-plugin-remove-console": "^1.1.0", "vite-plugin-remove-console": "^1.1.0",
"vite-svg-loader": "^3.4.0", "vite-svg-loader": "^3.4.0",

232
pnpm-lock.yaml generated
View File

@@ -57,7 +57,7 @@ specifiers:
dayjs: ^1.11.4 dayjs: ^1.11.4
driver.js: ^0.9.8 driver.js: ^0.9.8
echarts: ^5.3.3 echarts: ^5.3.3
element-plus: ^2.2.13 element-plus: ^2.2.14
element-resize-detector: ^1.2.3 element-resize-detector: ^1.2.3
eslint: ^8.8.0 eslint: ^8.8.0
eslint-plugin-prettier: ^4.0.0 eslint-plugin-prettier: ^4.0.0
@@ -100,10 +100,10 @@ specifiers:
stylelint-order: ^5.0.0 stylelint-order: ^5.0.0
swiper: ^8.3.2 swiper: ^8.3.2
typescript: ^4.7.4 typescript: ^4.7.4
unocss: ^0.45.8 unocss: ^0.45.9
unplugin-vue-define-options: ^0.7.3 unplugin-vue-define-options: ^0.7.3
v-contextmenu: 3.0.0 v-contextmenu: 3.0.0
vite: ^3.0.8 vite: ^3.0.9
vite-plugin-mock: ^2.9.6 vite-plugin-mock: ^2.9.6
vite-plugin-remove-console: ^1.1.0 vite-plugin-remove-console: ^1.1.0
vite-svg-loader: ^3.4.0 vite-svg-loader: ^3.4.0
@@ -145,7 +145,7 @@ dependencies:
dayjs: 1.11.5 dayjs: 1.11.5
driver.js: 0.9.8 driver.js: 0.9.8
echarts: 5.3.3 echarts: 5.3.3
element-plus: 2.2.13_vue@3.2.37 element-plus: 2.2.14_vue@3.2.37
element-resize-detector: 1.2.4 element-resize-detector: 1.2.4
js-cookie: 3.0.1 js-cookie: 3.0.1
jsbarcode: 3.11.5 jsbarcode: 3.11.5
@@ -192,7 +192,7 @@ devDependencies:
"@iconify-icons/ri": 1.2.3 "@iconify-icons/ri": 1.2.3
"@iconify-icons/uil": 1.2.2 "@iconify-icons/uil": 1.2.2
"@iconify/vue": 3.2.1_vue@3.2.37 "@iconify/vue": 3.2.1_vue@3.2.37
"@intlify/vite-plugin-vue-i18n": 6.0.1_vite@3.0.8+vue-i18n@9.2.2 "@intlify/vite-plugin-vue-i18n": 6.0.1_vite@3.0.9+vue-i18n@9.2.2
"@pureadmin/theme": 2.4.0 "@pureadmin/theme": 2.4.0
"@types/element-resize-detector": 1.1.3 "@types/element-resize-detector": 1.1.3
"@types/js-cookie": 3.0.2 "@types/js-cookie": 3.0.2
@@ -206,9 +206,9 @@ devDependencies:
"@types/sortablejs": 1.13.0 "@types/sortablejs": 1.13.0
"@typescript-eslint/eslint-plugin": 5.33.1_ac9d23a22d787f7b7991fddcc31412d2 "@typescript-eslint/eslint-plugin": 5.33.1_ac9d23a22d787f7b7991fddcc31412d2
"@typescript-eslint/parser": 5.33.1_eslint@8.22.0+typescript@4.7.4 "@typescript-eslint/parser": 5.33.1_eslint@8.22.0+typescript@4.7.4
"@vitejs/plugin-legacy": 2.0.1_vite@3.0.8 "@vitejs/plugin-legacy": 2.0.1_vite@3.0.9
"@vitejs/plugin-vue": 3.0.3_vite@3.0.8+vue@3.2.37 "@vitejs/plugin-vue": 3.0.3_vite@3.0.9+vue@3.2.37
"@vitejs/plugin-vue-jsx": 2.0.0_vite@3.0.8+vue@3.2.37 "@vitejs/plugin-vue-jsx": 2.0.0_vite@3.0.9+vue@3.2.37
"@vue/eslint-config-prettier": 7.0.0_eslint@8.22.0+prettier@2.7.1 "@vue/eslint-config-prettier": 7.0.0_eslint@8.22.0+prettier@2.7.1
"@vue/eslint-config-typescript": 10.0.0_c3cdf287d97b2ef58cc8a46e57dc8a9b "@vue/eslint-config-typescript": 10.0.0_c3cdf287d97b2ef58cc8a46e57dc8a9b
"@vue/runtime-core": 3.2.37 "@vue/runtime-core": 3.2.37
@@ -239,10 +239,10 @@ devDependencies:
stylelint-config-standard: 24.0.0_stylelint@14.10.0 stylelint-config-standard: 24.0.0_stylelint@14.10.0
stylelint-order: 5.0.0_stylelint@14.10.0 stylelint-order: 5.0.0_stylelint@14.10.0
typescript: 4.7.4 typescript: 4.7.4
unocss: 0.45.8_vite@3.0.8 unocss: 0.45.9_vite@3.0.9
unplugin-vue-define-options: 0.7.3_vite@3.0.8+vue@3.2.37 unplugin-vue-define-options: 0.7.3_vite@3.0.9+vue@3.2.37
vite: 3.0.8_sass@1.54.4 vite: 3.0.9_sass@1.54.4
vite-plugin-mock: 2.9.6_mockjs@1.1.0+vite@3.0.8 vite-plugin-mock: 2.9.6_mockjs@1.1.0+vite@3.0.9
vite-plugin-remove-console: 1.1.0 vite-plugin-remove-console: 1.1.0
vite-svg-loader: 3.4.0 vite-svg-loader: 3.4.0
vue-eslint-parser: 8.3.0_eslint@8.22.0 vue-eslint-parser: 8.3.0_eslint@8.22.0
@@ -1238,7 +1238,7 @@ packages:
engines: { node: ">= 14" } engines: { node: ">= 14" }
dev: false dev: false
/@intlify/vite-plugin-vue-i18n/6.0.1_vite@3.0.8+vue-i18n@9.2.2: /@intlify/vite-plugin-vue-i18n/6.0.1_vite@3.0.9+vue-i18n@9.2.2:
resolution: resolution:
{ {
integrity: sha512-FFVcxVU4bR9vdDLNbltM5mrhndnXMErO01i0RrpdyMegEt3Nu/YLoH0sFdjRun7/RY4vaEnhTnFvVf9uO0dQvg== integrity: sha512-FFVcxVU4bR9vdDLNbltM5mrhndnXMErO01i0RrpdyMegEt3Nu/YLoH0sFdjRun7/RY4vaEnhTnFvVf9uO0dQvg==
@@ -1262,7 +1262,7 @@ packages:
debug: 4.3.4 debug: 4.3.4
fast-glob: 3.2.11 fast-glob: 3.2.11
source-map: 0.6.1 source-map: 0.6.1
vite: 3.0.8_sass@1.54.4 vite: 3.0.9_sass@1.54.4
vue-i18n: 9.2.2_vue@3.2.37 vue-i18n: 9.2.2_vue@3.2.37
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@@ -1414,7 +1414,7 @@ packages:
} }
dependencies: dependencies:
"@element-plus/icons-vue": 2.0.9_vue@3.2.37 "@element-plus/icons-vue": 2.0.9_vue@3.2.37
element-plus: 2.2.13_vue@3.2.37 element-plus: 2.2.14_vue@3.2.37
vue: 3.2.37 vue: 3.2.37
transitivePeerDependencies: transitivePeerDependencies:
- "@vue/composition-api" - "@vue/composition-api"
@@ -1426,7 +1426,7 @@ packages:
integrity: sha512-mJBpMj0YkaqTM5TDz+ek/f8h74qRLhDc/gLJhBq0wpyfCgG++Jd/9i+QUj8gedA5oN8IL6LOSFbcvlGDYxHgkw== integrity: sha512-mJBpMj0YkaqTM5TDz+ek/f8h74qRLhDc/gLJhBq0wpyfCgG++Jd/9i+QUj8gedA5oN8IL6LOSFbcvlGDYxHgkw==
} }
dependencies: dependencies:
element-plus: 2.2.13_vue@3.2.37 element-plus: 2.2.14_vue@3.2.37
vue: 3.2.37 vue: 3.2.37
transitivePeerDependencies: transitivePeerDependencies:
- "@vue/composition-api" - "@vue/composition-api"
@@ -1853,17 +1853,17 @@ packages:
eslint-visitor-keys: 3.3.0 eslint-visitor-keys: 3.3.0
dev: true dev: true
/@unocss/cli/0.45.8: /@unocss/cli/0.45.9:
resolution: resolution:
{ {
integrity: sha512-/JyYXi4SsKNkEqB3wG/3FPAOHbQ4YTl0caI8KusMrbNIdGnBHTG9Vi5IzTE7Oyt3yksvwjfgNnOGsiRWBqxq2Q== integrity: sha512-DdSiCbLjmU5GkPKAykIeB/S28uSYWaqkdIMh7aQmg7i3ouCqp61vOeu9eiKoKK2HNm+ivPRznR4drk7zb6d9SA==
} }
engines: { node: ">=14" } engines: { node: ">=14" }
hasBin: true hasBin: true
dependencies: dependencies:
"@unocss/config": 0.45.8 "@unocss/config": 0.45.9
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
"@unocss/preset-uno": 0.45.8 "@unocss/preset-uno": 0.45.9
cac: 6.7.12 cac: 6.7.12
chokidar: 3.5.3 chokidar: 3.5.3
colorette: 2.0.19 colorette: 2.0.19
@@ -1873,182 +1873,182 @@ packages:
perfect-debounce: 0.1.3 perfect-debounce: 0.1.3
dev: true dev: true
/@unocss/config/0.45.8: /@unocss/config/0.45.9:
resolution: resolution:
{ {
integrity: sha512-iwxHS0yuf/tPab8Oij6Q9pjCUASAdUJC31n0rp3VpyexjzfI/335ysbEzrBuwgxLV3RWk7Z1kHizCw+kQwZ+tw== integrity: sha512-+HAtOxxW/BMNSunM7VwoCkCgb6SY8LpiGcfOnkrrynf/cne9RQQdfQPlMjbKLCIneBPtOSJWAKFMrPcVm0QW/w==
} }
engines: { node: ">=14" } engines: { node: ">=14" }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
unconfig: 0.3.5 unconfig: 0.3.5
dev: true dev: true
/@unocss/core/0.45.8: /@unocss/core/0.45.9:
resolution: resolution:
{ {
integrity: sha512-Iskmc1FaxIUAw4HK1U3htvXxJ4YAtffn3+ygNKY8+bzuOqhIk84vbp7SnHV3b8X6IHl4/OYzNRlVFhJQYnWV7g== integrity: sha512-ZUHgE8q7oYNFW+lPyH71n2weR9mhYL4WY/FL6K+sa9mVEYA4Lq15sCKTB+fbowB4CDLxZ8BEGNX3I9Qpn46lHA==
} }
dev: true dev: true
/@unocss/inspector/0.45.8: /@unocss/inspector/0.45.9:
resolution: resolution:
{ {
integrity: sha512-dvGYyVVofH8VxMvqaRfysxIbRkaunvs5M5Z8UVaCCfjfrDX6nqAQfSOakXWODEz8Y2JEfKEDLWfSn+oQWb9ohA== integrity: sha512-/GFt/NG349cs9HnVejQe0T2HUUx8lOIjSP0cgReibWJ2idIuu9NLYPTh1YuT37ygHkze19106/HLu50lGtjAmw==
} }
dependencies: dependencies:
gzip-size: 6.0.0 gzip-size: 6.0.0
sirv: 2.0.2 sirv: 2.0.2
dev: true dev: true
/@unocss/preset-attributify/0.45.8: /@unocss/preset-attributify/0.45.9:
resolution: resolution:
{ {
integrity: sha512-5j8TfoYWKkpV0f2fwDTtAyRl+2zoquqg5JfuQDr1ELUpSodmHq9hMvt53EmG/S1wotijthsdh8jcjCRLQ36Xuw== integrity: sha512-jIpBx7J3XHg/QBxybU4kZr9io853ifrkcs/QfKgc2DFq+iOQfnIxFuMGJNs7oH2Py86MkX6ZkYuDJ5IlcE+v2A==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
dev: true dev: true
/@unocss/preset-icons/0.45.8: /@unocss/preset-icons/0.45.9:
resolution: resolution:
{ {
integrity: sha512-2dcK2Z8xMiJoKhgraTyarJioqyh2SglXrvJ+xp7HNDOhwQcbzxdw9JzwBT1hCq03ohm2Z1CdF9xP9nbFqdpY/A== integrity: sha512-Tla5xII9TzLgunOu4sbOshJwif2FYcX1xgql6KeFhL6f37Z6EUiax4TBgPC3GIreleRLhACVP8sZUil3fK2zcA==
} }
dependencies: dependencies:
"@iconify/utils": 1.0.33 "@iconify/utils": 1.0.33
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
ohmyfetch: 0.4.18 ohmyfetch: 0.4.18
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
/@unocss/preset-mini/0.45.8: /@unocss/preset-mini/0.45.9:
resolution: resolution:
{ {
integrity: sha512-MWQWt7CR9lqR/2N7dnVQrxxuTxxccL7xj82qb8i2P1qQScyVVdPKTeUozu/oA5HrR0ujh+qjV1iTC8RB5HxbbQ== integrity: sha512-WLBKaE+WYBPbRK4Q3lHDBf8luFElNd0cG4e05Tttg028ImZIhDsPGkGAGLKk5wmA1CiUvG/K976NywOchA9T6A==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
dev: true dev: true
/@unocss/preset-tagify/0.45.8: /@unocss/preset-tagify/0.45.9:
resolution: resolution:
{ {
integrity: sha512-ePq3HUxPIuQR8MPDtgrzB/dOYGyba2KtCUjp5Zy0EPY4bd31ysz2AixjOOygFQIx5JrnYKs6WxW9PdhwMJUnXg== integrity: sha512-cOjxRp3EWWJSVA69NiqsRdLlB2SFGys4w+44X4UYe0yYHr2L3bJEK66gPj3YLuyiBfmbv5RSv1OaP2a1RHQ1ZA==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
dev: true dev: true
/@unocss/preset-typography/0.45.8: /@unocss/preset-typography/0.45.9:
resolution: resolution:
{ {
integrity: sha512-x0MyuyPLfwvQenHwVHhLRzhjtuQL9S5qkdGh04kOySprp1wIsu14L6w/zFequvVSk55Tb8s+QMd9TmTYR/MZPg== integrity: sha512-TaHnAZd6UU2qNz0dEqoniBrwEOCpsifZquOK6hFRCj4FKwWWP2VEOgdVclgjL8DDWLZeS4bfTn2zQ5pGfo8tDQ==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
dev: true dev: true
/@unocss/preset-uno/0.45.8: /@unocss/preset-uno/0.45.9:
resolution: resolution:
{ {
integrity: sha512-WxE9aAHCnmZMwzdhiKYawvyQx1wucl/AsoxTpnNgToARaGLiQiWJCT7ov0VgNndbxD1mfCIA4f9LxNklkFVZzA== integrity: sha512-YqQRPeVDrY7poBUw0tOOD3Vd8QCEmhIjN63MovA0RnEG6NMweMuJ5ahqVarfp3Rrcfycmgya6WWGk6ZOlinl5A==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
"@unocss/preset-mini": 0.45.8 "@unocss/preset-mini": 0.45.9
"@unocss/preset-wind": 0.45.8 "@unocss/preset-wind": 0.45.9
dev: true dev: true
/@unocss/preset-web-fonts/0.45.8: /@unocss/preset-web-fonts/0.45.9:
resolution: resolution:
{ {
integrity: sha512-GvBZrDtAOkyOwphdzT3v1QniJfFssR0LhWfJPBpNsOi3Of2iz8Zq0LisbPF7PEFS0fPicijDcgyVUTj1TK71Ew== integrity: sha512-kWYfUcvRvoPyxmf6q8AZV+cLeVJH6p4tmvDnV9iLckCThYYC+6ADHlnRimv8PJtVvy6hgv46vf0X3ZA4HLSqzg==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
ohmyfetch: 0.4.18 ohmyfetch: 0.4.18
dev: true dev: true
/@unocss/preset-wind/0.45.8: /@unocss/preset-wind/0.45.9:
resolution: resolution:
{ {
integrity: sha512-AWupVDOIRswf8CnKkWeBi1G7UBjrigQHewj/VPtnXPP7bqOHY91+4T/iaTtYJ5lrKauYVR4ZndOM1qJGEY09Gg== integrity: sha512-LMlWg8jsUwqlhd6jwtn5QCTzb1et0k7yNIZwyL6Y2AOHW5g5jqaTvKTWVjQpfu9wmlxTTVXDBmaOV3cOiosvuw==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
"@unocss/preset-mini": 0.45.8 "@unocss/preset-mini": 0.45.9
dev: true dev: true
/@unocss/reset/0.45.8: /@unocss/reset/0.45.9:
resolution: resolution:
{ {
integrity: sha512-zeIYa/d/amPhX6/del0k6K8/Hdl/nN12XCeiVfBKymlilAjQQyV64V/qdLBtSKzqegT68O/xMscla7pZDto4Hw== integrity: sha512-FiLi3jas0L3CkfdAYXRybRjAjGz9lZQ4+8IglBXKyR9UDnHssNemo5+NGEv7xpsItPm99b/lsMvLnx1JX/As5Q==
} }
dev: true dev: true
/@unocss/scope/0.45.8: /@unocss/scope/0.45.9:
resolution: resolution:
{ {
integrity: sha512-Zf08xhCBqFHCaf8kGwMXu0+JRR3U9v8m7Y2LwUK4zg6LdcfGX9luykPfiNJSsFQ20l7cWBcj2g4tWdzFvIcDMA== integrity: sha512-1JOv+xCYYetofqpfWmBX1kXIqo2n788FRWNPzkbSGaH5qdS9za1+wECBlTiWpbvyfeB4gX88d8+DX9YL4PjVdA==
} }
dev: true dev: true
/@unocss/transformer-attributify-jsx/0.45.8: /@unocss/transformer-attributify-jsx/0.45.9:
resolution: resolution:
{ {
integrity: sha512-tpWr37wXvOPkMuXaTGkjSbKqz4DD2MuxKxzTs+DUQ5H7ABvp/XVnCiHudtgjLzaVAfEZgdybKFUs+xX+RuxnWA== integrity: sha512-QgCuztKpm0jLZhJbEWGrajwT1iURtGXtALBLVdqqM/D5FoFpHpkddOhr5ud+XGoyRhy9E9m9WdfyTq8g97HHgQ==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
dev: true dev: true
/@unocss/transformer-compile-class/0.45.8: /@unocss/transformer-compile-class/0.45.9:
resolution: resolution:
{ {
integrity: sha512-nYIQbXgc8yyzSYqIrb3+mojFTewOavmYreC+cmsvFhE+q3q5ZpdXNx0hgpkOFQ7Dg5KoPG9aKH+dXFjG33GcmQ== integrity: sha512-x0MWUdTMPndS4AZEwlV+ugDdTYeezEGCC0fKb/jKujF3RMf9m6C8/MZw3eiZ5LNHKU1kfor1NWCTjshXl4pV3Q==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
dev: true dev: true
/@unocss/transformer-directives/0.45.8: /@unocss/transformer-directives/0.45.9:
resolution: resolution:
{ {
integrity: sha512-das5qyPOXjw7I6eXm6ETrnBQmfwzJo/RGMUkWmed67sYL4tWGLLYu8fOqoIR8vPGc6h5YmFjBGqOOCyX+NDmlg== integrity: sha512-88t2zWFVpYNk3kFBiJWW4oYerbVnyk9smPZD9+HJewPJbvbHm6UboW4rEy3KepT2heyn7GTpLjfLD08yDZFvIA==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
css-tree: 2.2.1 css-tree: 2.2.1
dev: true dev: true
/@unocss/transformer-variant-group/0.45.8: /@unocss/transformer-variant-group/0.45.9:
resolution: resolution:
{ {
integrity: sha512-fp1tNBhO3VPxOnzDWZNqrQ1oWngeYUXeJZRl94pdsp+4nWoFrbCXG/nDn7a+Qk223al32B3rO/GLJl7nOpSmRw== integrity: sha512-xB7ygI81u9yVpJvKDo5l03KC0zwJRerpncNxpReDpPGTcpnoYqoazX0CZ/sCekuE3ErZC6UJkyknEuwT+8owog==
} }
dependencies: dependencies:
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
dev: true dev: true
/@unocss/vite/0.45.8_vite@3.0.8: /@unocss/vite/0.45.9_vite@3.0.9:
resolution: resolution:
{ {
integrity: sha512-uGKe0tbxcJgk9aEKa+AYjbU3i0Yh1N7ekvdLGZD+xwk+EvIOg4Hc8mym5gOOh4wRYKROoVOPp1Z7m+GwCVecAA== integrity: sha512-Wb0JSaO/D8IvXku6+bImr4oobYbFFcqXYAT3QrWTYdCuEZ7Zn6svNN4f1baMvKH5djm7cn9YNL7lroOXN0/m8Q==
} }
peerDependencies: peerDependencies:
vite: ^2.9.0 || ^3.0.0-0 vite: ^2.9.0 || ^3.0.0-0
dependencies: dependencies:
"@ampproject/remapping": 2.2.0 "@ampproject/remapping": 2.2.0
"@rollup/pluginutils": 4.2.1 "@rollup/pluginutils": 4.2.1
"@unocss/config": 0.45.8 "@unocss/config": 0.45.9
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
"@unocss/inspector": 0.45.8 "@unocss/inspector": 0.45.9
"@unocss/scope": 0.45.8 "@unocss/scope": 0.45.9
"@unocss/transformer-directives": 0.45.8 "@unocss/transformer-directives": 0.45.9
magic-string: 0.26.2 magic-string: 0.26.2
vite: 3.0.8_sass@1.54.4 vite: 3.0.9_sass@1.54.4
dev: true dev: true
/@uppy/companion-client/2.2.1: /@uppy/companion-client/2.2.1:
@@ -2107,7 +2107,7 @@ packages:
nanoid: 3.3.4 nanoid: 3.3.4
dev: false dev: false
/@vitejs/plugin-legacy/2.0.1_vite@3.0.8: /@vitejs/plugin-legacy/2.0.1_vite@3.0.9:
resolution: resolution:
{ {
integrity: sha512-kKC56rfsXwebApzyuZqdQlGmqTyH1ugy0l0rY58gx5OXzq4/t5/DCqGUoz53Db51OqfjRqsHfqmvq9or6w9k/Q== integrity: sha512-kKC56rfsXwebApzyuZqdQlGmqTyH1ugy0l0rY58gx5OXzq4/t5/DCqGUoz53Db51OqfjRqsHfqmvq9or6w9k/Q==
@@ -2125,10 +2125,10 @@ packages:
magic-string: 0.26.2 magic-string: 0.26.2
regenerator-runtime: 0.13.9 regenerator-runtime: 0.13.9
systemjs: 6.12.2 systemjs: 6.12.2
vite: 3.0.8_sass@1.54.4 vite: 3.0.9_sass@1.54.4
dev: true dev: true
/@vitejs/plugin-vue-jsx/2.0.0_vite@3.0.8+vue@3.2.37: /@vitejs/plugin-vue-jsx/2.0.0_vite@3.0.9+vue@3.2.37:
resolution: resolution:
{ {
integrity: sha512-WF9ApZ/ivyyW3volQfu0Td0KNPhcccYEaRNzNY1NxRLVJQLSX0nFqquv3e2g7MF74p1XZK4bGtDL2y5i5O5+1A== integrity: sha512-WF9ApZ/ivyyW3volQfu0Td0KNPhcccYEaRNzNY1NxRLVJQLSX0nFqquv3e2g7MF74p1XZK4bGtDL2y5i5O5+1A==
@@ -2142,13 +2142,13 @@ packages:
"@babel/plugin-syntax-import-meta": 7.10.4_@babel+core@7.18.10 "@babel/plugin-syntax-import-meta": 7.10.4_@babel+core@7.18.10
"@babel/plugin-transform-typescript": 7.18.12_@babel+core@7.18.10 "@babel/plugin-transform-typescript": 7.18.12_@babel+core@7.18.10
"@vue/babel-plugin-jsx": 1.1.1_@babel+core@7.18.10 "@vue/babel-plugin-jsx": 1.1.1_@babel+core@7.18.10
vite: 3.0.8_sass@1.54.4 vite: 3.0.9_sass@1.54.4
vue: 3.2.37 vue: 3.2.37
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
/@vitejs/plugin-vue/3.0.3_vite@3.0.8+vue@3.2.37: /@vitejs/plugin-vue/3.0.3_vite@3.0.9+vue@3.2.37:
resolution: resolution:
{ {
integrity: sha512-U4zNBlz9mg+TA+i+5QPc3N5lQvdUXENZLO2h0Wdzp56gI1MWhqJOv+6R+d4kOzoaSSq6TnGPBdZAXKOe4lXy6g== integrity: sha512-U4zNBlz9mg+TA+i+5QPc3N5lQvdUXENZLO2h0Wdzp56gI1MWhqJOv+6R+d4kOzoaSSq6TnGPBdZAXKOe4lXy6g==
@@ -2158,7 +2158,7 @@ packages:
vite: ^3.0.0 vite: ^3.0.0
vue: ^3.2.25 vue: ^3.2.25
dependencies: dependencies:
vite: 3.0.8_sass@1.54.4 vite: 3.0.9_sass@1.54.4
vue: 3.2.37 vue: 3.2.37
dev: true dev: true
@@ -4150,10 +4150,10 @@ packages:
} }
dev: true dev: true
/element-plus/2.2.13_vue@3.2.37: /element-plus/2.2.14_vue@3.2.37:
resolution: resolution:
{ {
integrity: sha512-dKQ7BPZC8deUPhv+6s4GgOL0GyGj3KpUarywxm6s1nWnHjH6FqeZlUcxPqBvJd7W/d81POayx3B13GP+rfkG9g== integrity: sha512-V5Pis0OHhePg1RgVogZrcefaVl8vjVn4Pn9Qsh/t2CbFgjg9kKOYFqf/tuP3ObSXGm3X89hpe0W+nLVAsaFnpw==
} }
peerDependencies: peerDependencies:
vue: ^3.2.0 vue: ^3.2.0
@@ -4164,7 +4164,7 @@ packages:
"@popperjs/core": /@sxzz/popperjs-es/2.11.7 "@popperjs/core": /@sxzz/popperjs-es/2.11.7
"@types/lodash": 4.14.183 "@types/lodash": 4.14.183
"@types/lodash-es": 4.17.6 "@types/lodash-es": 4.17.6
"@vueuse/core": 8.9.4_vue@3.2.37 "@vueuse/core": 9.1.0_vue@3.2.37
async-validator: 4.2.5 async-validator: 4.2.5
dayjs: 1.11.5 dayjs: 1.11.5
escape-html: 1.0.3 escape-html: 1.0.3
@@ -8786,34 +8786,34 @@ packages:
engines: { node: ">= 10.0.0" } engines: { node: ">= 10.0.0" }
dev: true dev: true
/unocss/0.45.8_vite@3.0.8: /unocss/0.45.9_vite@3.0.9:
resolution: resolution:
{ {
integrity: sha512-OIStfHtH0sv1MYz0x+fa8wEBuwRS0lFhnlRwo/zxnNSh5zS+szMKeowhXoC/eoOQBUA1qoHux0qG5GdcJnX2Lg== integrity: sha512-f2gTI1cn2/GZRbvSnCaWZa03IdcRnK33AiBtpJoDW61IRNt7lu+D1upCnkKPjcTrDFTmI7DryXGHlG/b8p4wTQ==
} }
engines: { node: ">=14" } engines: { node: ">=14" }
peerDependencies: peerDependencies:
"@unocss/webpack": 0.45.8 "@unocss/webpack": 0.45.9
peerDependenciesMeta: peerDependenciesMeta:
"@unocss/webpack": "@unocss/webpack":
optional: true optional: true
dependencies: dependencies:
"@unocss/cli": 0.45.8 "@unocss/cli": 0.45.9
"@unocss/core": 0.45.8 "@unocss/core": 0.45.9
"@unocss/preset-attributify": 0.45.8 "@unocss/preset-attributify": 0.45.9
"@unocss/preset-icons": 0.45.8 "@unocss/preset-icons": 0.45.9
"@unocss/preset-mini": 0.45.8 "@unocss/preset-mini": 0.45.9
"@unocss/preset-tagify": 0.45.8 "@unocss/preset-tagify": 0.45.9
"@unocss/preset-typography": 0.45.8 "@unocss/preset-typography": 0.45.9
"@unocss/preset-uno": 0.45.8 "@unocss/preset-uno": 0.45.9
"@unocss/preset-web-fonts": 0.45.8 "@unocss/preset-web-fonts": 0.45.9
"@unocss/preset-wind": 0.45.8 "@unocss/preset-wind": 0.45.9
"@unocss/reset": 0.45.8 "@unocss/reset": 0.45.9
"@unocss/transformer-attributify-jsx": 0.45.8 "@unocss/transformer-attributify-jsx": 0.45.9
"@unocss/transformer-compile-class": 0.45.8 "@unocss/transformer-compile-class": 0.45.9
"@unocss/transformer-directives": 0.45.8 "@unocss/transformer-directives": 0.45.9
"@unocss/transformer-variant-group": 0.45.8 "@unocss/transformer-variant-group": 0.45.9
"@unocss/vite": 0.45.8_vite@3.0.8 "@unocss/vite": 0.45.9_vite@3.0.9
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
- vite - vite
@@ -8827,7 +8827,7 @@ packages:
engines: { node: ">= 0.8" } engines: { node: ">= 0.8" }
dev: true dev: true
/unplugin-vue-define-options/0.7.3_vite@3.0.8+vue@3.2.37: /unplugin-vue-define-options/0.7.3_vite@3.0.9+vue@3.2.37:
resolution: resolution:
{ {
integrity: sha512-VbexYR8m2v/TLi49+F7Yf3rO2EyS0EkrXjJxqym6W0NxOzom9zdmRUR+av4UAu4GruhMumJc/9ITS1Wj+rozjg== integrity: sha512-VbexYR8m2v/TLi49+F7Yf3rO2EyS0EkrXjJxqym6W0NxOzom9zdmRUR+av4UAu4GruhMumJc/9ITS1Wj+rozjg==
@@ -8838,7 +8838,7 @@ packages:
dependencies: dependencies:
"@rollup/pluginutils": 4.2.1 "@rollup/pluginutils": 4.2.1
"@vue/compiler-sfc": 3.2.37 "@vue/compiler-sfc": 3.2.37
unplugin: 0.8.1_vite@3.0.8 unplugin: 0.8.1_vite@3.0.9
vue: 3.2.37 vue: 3.2.37
transitivePeerDependencies: transitivePeerDependencies:
- esbuild - esbuild
@@ -8847,7 +8847,7 @@ packages:
- webpack - webpack
dev: true dev: true
/unplugin/0.8.1_vite@3.0.8: /unplugin/0.8.1_vite@3.0.9:
resolution: resolution:
{ {
integrity: sha512-o7rUZoPLG1fH4LKinWgb77gDtTE6mw/iry0Pq0Z5UPvZ9+HZ1/4+7fic7t58s8/CGkPrDpGq+RltO+DmswcR4g== integrity: sha512-o7rUZoPLG1fH4LKinWgb77gDtTE6mw/iry0Pq0Z5UPvZ9+HZ1/4+7fic7t58s8/CGkPrDpGq+RltO+DmswcR4g==
@@ -8869,7 +8869,7 @@ packages:
dependencies: dependencies:
acorn: 8.8.0 acorn: 8.8.0
chokidar: 3.5.3 chokidar: 3.5.3
vite: 3.0.8_sass@1.54.4 vite: 3.0.9_sass@1.54.4
webpack-sources: 3.2.3 webpack-sources: 3.2.3
webpack-virtual-modules: 0.4.4 webpack-virtual-modules: 0.4.4
dev: true dev: true
@@ -8954,7 +8954,7 @@ packages:
spdx-expression-parse: 3.0.1 spdx-expression-parse: 3.0.1
dev: true dev: true
/vite-plugin-mock/2.9.6_mockjs@1.1.0+vite@3.0.8: /vite-plugin-mock/2.9.6_mockjs@1.1.0+vite@3.0.9:
resolution: resolution:
{ {
integrity: sha512-/Rm59oPppe/ncbkSrUuAxIQihlI2YcBmnbR4ST1RA2VzM1C0tEQc1KlbQvnUGhXECAGTaQN2JyasiwXP6EtKgg== integrity: sha512-/Rm59oPppe/ncbkSrUuAxIQihlI2YcBmnbR4ST1RA2VzM1C0tEQc1KlbQvnUGhXECAGTaQN2JyasiwXP6EtKgg==
@@ -8974,7 +8974,7 @@ packages:
fast-glob: 3.2.11 fast-glob: 3.2.11
mockjs: 1.1.0 mockjs: 1.1.0
path-to-regexp: 6.2.1 path-to-regexp: 6.2.1
vite: 3.0.8_sass@1.54.4 vite: 3.0.9_sass@1.54.4
transitivePeerDependencies: transitivePeerDependencies:
- rollup - rollup
- supports-color - supports-color
@@ -8997,10 +8997,10 @@ packages:
svgo: 2.8.0 svgo: 2.8.0
dev: true dev: true
/vite/3.0.8_sass@1.54.4: /vite/3.0.9_sass@1.54.4:
resolution: resolution:
{ {
integrity: sha512-AOZ4eN7mrkJiOLuw8IA7piS4IdOQyQCA81GxGsAQvAZzMRi9ZwGB3TOaYsj4uLAWK46T5L4AfQ6InNGlxX30IQ== integrity: sha512-waYABTM+G6DBTCpYAxvevpG50UOlZuynR0ckTK5PawNVt7ebX6X7wNXHaGIO6wYYFXSM7/WcuFuO2QzhBB6aMw==
} }
engines: { node: ^14.18.0 || >=16.0.0 } engines: { node: ^14.18.0 || >=16.0.0 }
hasBin: true hasBin: true
@@ -9076,7 +9076,7 @@ packages:
ace-builds: 1.9.6 ace-builds: 1.9.6
ant-design-vue: 3.2.11_vue@3.2.37 ant-design-vue: 3.2.11_vue@3.2.37
core-js: 3.24.1 core-js: 3.24.1
element-plus: 2.2.13_vue@3.2.37 element-plus: 2.2.14_vue@3.2.37
lodash: 4.17.21 lodash: 4.17.21
uuid: 8.3.2 uuid: 8.3.2
vue: 3.2.37 vue: 3.2.37

View File

@@ -1,5 +1,5 @@
{ {
"Version": "3.3.5", "Version": "3.4.5",
"Title": "PureAdmin", "Title": "PureAdmin",
"FixedHeader": true, "FixedHeader": true,
"HiddenSideBar": false, "HiddenSideBar": false,

View File

@@ -156,7 +156,7 @@ watch(
> >
<el-divider class="tab-divider" border-style="dashed" /> <el-divider class="tab-divider" border-style="dashed" />
<el-scrollbar height="220px"> <el-scrollbar height="220px">
<ul class="flex flex-wrap px-2 ml-2"> <ul class="flex-wrap px-2 ml-2">
<li <li
v-for="(item, key) in pageList" v-for="(item, key) in pageList"
:key="key" :key="key"

View File

@@ -428,7 +428,7 @@ function scrollInitMove() {
if (timer) clearTimeout(timer); if (timer) clearTimeout(timer);
copyHtml.value = unref(slotList).innerHTML; copyHtml.value = unref(slotList).innerHTML;
setTimeout(() => { setTimeout(() => {
realBoxHeight.value = unref(realBox).offsetHeight; realBoxHeight.value = unref(realBox)?.offsetHeight;
scrollMove(); scrollMove();
}, 0); }, 0);
} else { } else {
@@ -454,7 +454,6 @@ function scrollStopMove() {
// 鼠标滚轮事件 // 鼠标滚轮事件
function wheel(e) { function wheel(e) {
e.preventDefault();
if ( if (
unref(options).direction === "left" || unref(options).direction === "left" ||
unref(options).direction === "right" unref(options).direction === "right"
@@ -517,10 +516,10 @@ defineExpose({
:style="pos" :style="pos"
@mouseenter="enter" @mouseenter="enter"
@mouseleave="leave" @mouseleave="leave"
@touchstart="touchStart" @touchstart.passive="touchStart"
@touchmove="touchMove" @touchmove.passive="touchMove"
@touchend="touchEnd" @touchend="touchEnd"
@mousewheel="wheel" @mousewheel.passive="wheel"
> >
<div :ref="'slotList' + classOption['key']" :style="float"> <div :ref="'slotList' + classOption['key']" :style="float">
<slot /> <slot />

View File

@@ -12,6 +12,7 @@ import { getConfig } from "/@/config";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import panel from "../panel/index.vue"; import panel from "../panel/index.vue";
import { emitter } from "/@/utils/mitt"; import { emitter } from "/@/utils/mitt";
import { resetRouter } from "/@/router";
import { templateRef } from "@vueuse/core"; import { templateRef } from "@vueuse/core";
import { routerArrays } from "/@/layout/types"; import { routerArrays } from "/@/layout/types";
import { useNav } from "/@/layout/hooks/useNav"; import { useNav } from "/@/layout/hooks/useNav";
@@ -140,6 +141,7 @@ function onReset() {
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]); useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
storageLocal.clear(); storageLocal.clear();
storageSession.clear(); storageSession.clear();
resetRouter();
} }
function onChange(label) { function onChange(label) {
@@ -209,8 +211,9 @@ function setLayoutModel(layout: string) {
$storage.layout = { $storage.layout = {
layout, layout,
theme: layoutTheme.value.theme, theme: layoutTheme.value.theme,
darkMode: $storage.layout.darkMode, darkMode: $storage.layout?.darkMode,
sidebarStatus: $storage.layout.sidebarStatus sidebarStatus: $storage.layout?.sidebarStatus,
epThemeColor: $storage.layout?.epThemeColor
}; };
useAppStoreHook().setLayout(layout); useAppStoreHook().setLayout(layout);
} }

View File

@@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue";
import { isEqual } from "lodash-unified"; import { isEqual } from "lodash-unified";
import { transformI18n } from "/@/plugins/i18n"; import { transformI18n } from "/@/plugins/i18n";
import { ref, watch, onMounted, toRaw } from "vue";
import { getParentPaths, findRouteByPath } from "/@/router/utils"; import { getParentPaths, findRouteByPath } from "/@/router/utils";
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags"; import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
import { useRoute, useRouter, RouteLocationMatched } from "vue-router"; import { useRoute, useRouter, RouteLocationMatched } from "vue-router";
@@ -14,19 +14,24 @@ const multiTags: any = useMultiTagsStoreHook().multiTags;
const isDashboard = (route: RouteLocationMatched): boolean | string => { const isDashboard = (route: RouteLocationMatched): boolean | string => {
const name = route && (route.name as string); const name = route && (route.name as string);
if (!name) { if (!name) return false;
return false;
}
return name.trim().toLocaleLowerCase() === "Welcome".toLocaleLowerCase(); return name.trim().toLocaleLowerCase() === "Welcome".toLocaleLowerCase();
}; };
const getBreadcrumb = (): void => { const getBreadcrumb = (): void => {
// 当前路由信息 // 当前路由信息
let currentRoute; let currentRoute;
if (Object.keys(route.query).length > 0) { if (Object.keys(route.query).length > 0) {
multiTags.forEach(item => { multiTags.forEach(item => {
if (isEqual(route.query, item?.query)) { if (isEqual(route.query, item?.query)) {
currentRoute = item; currentRoute = toRaw(item);
}
});
} else if (Object.keys(route.params).length > 0) {
multiTags.forEach(item => {
if (isEqual(route.params, item?.params)) {
currentRoute = toRaw(item);
} }
}); });
} else { } else {
@@ -38,29 +43,12 @@ const getBreadcrumb = (): void => {
let matched = []; let matched = [];
// 获取每个父级路径对应的路由信息 // 获取每个父级路径对应的路由信息
parentRoutes.forEach(path => { parentRoutes.forEach(path => {
if (path !== "/") { if (path !== "/") matched.push(findRouteByPath(path, routes));
matched.push(findRouteByPath(path, routes));
}
}); });
if (router.currentRoute.value.meta?.refreshRedirect) {
matched.unshift(
findRouteByPath(
router.currentRoute.value.meta.refreshRedirect as string,
routes
)
);
} else {
// 过滤与子级相同标题的父级路由
matched = matched.filter(item => {
return !item.redirect || (item.redirect && item.children.length !== 1);
});
}
if (currentRoute?.path !== "/welcome") {
matched.push(currentRoute);
}
const first = matched[0]; if (currentRoute?.path !== "/welcome") matched.push(currentRoute);
if (!isDashboard(first)) {
if (!isDashboard(matched[0])) {
matched = [ matched = [
{ {
path: "/welcome", path: "/welcome",
@@ -70,60 +58,51 @@ const getBreadcrumb = (): void => {
].concat(matched); ].concat(matched);
} }
matched.forEach((item, index) => {
if (currentRoute?.query || currentRoute?.params) return;
if (item?.children) {
item.children.forEach(v => {
if (v?.meta?.title === item?.meta?.title) {
matched.splice(index, 1);
}
});
}
});
levelList.value = matched.filter( levelList.value = matched.filter(
item => item?.meta && item?.meta.title !== false item => item?.meta && item?.meta.title !== false
); );
}; };
getBreadcrumb(); const handleLink = (item: RouteLocationMatched): void => {
const { redirect, path } = item;
if (redirect) {
router.push(redirect as any);
} else {
router.push(path);
}
};
onMounted(() => {
getBreadcrumb();
});
watch( watch(
() => route.path, () => route.path,
() => getBreadcrumb() () => {
); getBreadcrumb();
watch(
() => route.query,
() => getBreadcrumb()
);
const handleLink = (item: RouteLocationMatched): any => {
const { redirect, path } = item;
if (redirect) {
router.push(redirect.toString());
return;
} }
router.push(path); );
};
</script> </script>
<template> <template>
<el-breadcrumb class="app-breadcrumb select-none" separator="/"> <el-breadcrumb class="!leading-[50px] select-none" separator="/">
<transition-group appear name="breadcrumb"> <transition-group appear name="breadcrumb">
<el-breadcrumb-item v-for="(item, index) in levelList" :key="item.path"> <el-breadcrumb-item v-for="item in levelList" :key="item.path">
<span <a @click.prevent="handleLink(item)">
v-if="item.redirect === 'noRedirect' || index == levelList.length - 1"
class="no-redirect"
>
{{ transformI18n(item.meta.title) }}
</span>
<a v-else @click.prevent="handleLink(item)">
{{ transformI18n(item.meta.title) }} {{ transformI18n(item.meta.title) }}
</a> </a>
</el-breadcrumb-item> </el-breadcrumb-item>
</transition-group> </transition-group>
</el-breadcrumb> </el-breadcrumb>
</template> </template>
<style lang="scss" scoped>
.app-breadcrumb.el-breadcrumb {
display: inline-block;
font-size: 14px;
line-height: 50px;
.no-redirect {
color: #97a8be;
cursor: text;
}
}
</style>

View File

@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue";
import Search from "../search/index.vue"; import Search from "../search/index.vue";
import Notice from "../notice/index.vue"; import Notice from "../notice/index.vue";
import SidebarItem from "./sidebarItem.vue"; import SidebarItem from "./sidebarItem.vue";
@@ -9,7 +10,6 @@ import { deviceDetection } from "@pureadmin/utils";
import { useTranslationLang } from "../../hooks/useTranslationLang"; import { useTranslationLang } from "../../hooks/useTranslationLang";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "/@/store/modules/permission";
import globalization from "/@/assets/svg/globalization.svg?component"; import globalization from "/@/assets/svg/globalization.svg?component";
import { ref, watch, nextTick, onMounted, onBeforeUnmount } from "vue";
const menuRef = ref(); const menuRef = ref();
@@ -21,7 +21,6 @@ const {
logout, logout,
backHome, backHome,
onPanel, onPanel,
handleResize,
menuSelect, menuSelect,
username, username,
avatarsStyle, avatarsStyle,
@@ -29,20 +28,6 @@ const {
getDropdownItemClass getDropdownItemClass
} = useNav(); } = useNav();
function onResizeMenu() {
nextTick(() => {
handleResize(menuRef.value);
});
}
onMounted(() => {
window.addEventListener("resize", onResizeMenu);
});
onBeforeUnmount(() => {
window.removeEventListener("resize", onResizeMenu);
});
watch( watch(
() => route.path, () => route.path,
() => { () => {

View File

@@ -6,12 +6,12 @@ import { useNav } from "/@/layout/hooks/useNav";
import { transformI18n } from "/@/plugins/i18n"; import { transformI18n } from "/@/plugins/i18n";
import screenfull from "../screenfull/index.vue"; import screenfull from "../screenfull/index.vue";
import { deviceDetection } from "@pureadmin/utils"; import { deviceDetection } from "@pureadmin/utils";
import { ref, toRaw, watch, onMounted } from "vue";
import { useRenderIcon } from "/@/components/ReIcon/src/hooks"; import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
import { getParentPaths, findRouteByPath } from "/@/router/utils"; import { getParentPaths, findRouteByPath } from "/@/router/utils";
import { useTranslationLang } from "../../hooks/useTranslationLang"; import { useTranslationLang } from "../../hooks/useTranslationLang";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "/@/store/modules/permission";
import globalization from "/@/assets/svg/globalization.svg?component"; import globalization from "/@/assets/svg/globalization.svg?component";
import { ref, toRaw, watch, nextTick, onMounted, onBeforeUnmount } from "vue";
const menuRef = ref(); const menuRef = ref();
let defaultActive = ref(null); let defaultActive = ref(null);
@@ -23,7 +23,6 @@ const {
routers, routers,
logout, logout,
onPanel, onPanel,
handleResize,
menuSelect, menuSelect,
resolvePath, resolvePath,
username, username,
@@ -42,19 +41,8 @@ function getDefaultActive(routePath) {
)?.children[0]?.path; )?.children[0]?.path;
} }
function onResizeMenu() {
nextTick(() => {
handleResize(menuRef.value);
});
}
onMounted(() => { onMounted(() => {
getDefaultActive(route.path); getDefaultActive(route.path);
window.addEventListener("resize", onResizeMenu);
});
onBeforeUnmount(() => {
window.removeEventListener("resize", onResizeMenu);
}); });
watch( watch(

View File

@@ -1,123 +1,53 @@
<script setup lang="ts"> <script setup lang="ts">
import {
ref,
watch,
unref,
toRaw,
reactive,
nextTick,
computed,
ComputedRef,
CSSProperties,
onBeforeMount,
getCurrentInstance
} from "vue";
import close from "/@/assets/svg/close.svg?component";
import refresh from "/@/assets/svg/refresh.svg?component";
import closeAll from "/@/assets/svg/close_all.svg?component";
import closeLeft from "/@/assets/svg/close_left.svg?component";
import closeOther from "/@/assets/svg/close_other.svg?component";
import closeRight from "/@/assets/svg/close_right.svg?component";
import { useI18n } from "vue-i18n";
import { emitter } from "/@/utils/mitt"; import { emitter } from "/@/utils/mitt";
import type { StorageConfigs } from "/#/index"; import { RouteConfigs } from "../../types";
import { useTags } from "../../hooks/useTag";
import { routerArrays } from "/@/layout/types"; import { routerArrays } from "/@/layout/types";
import { useRoute, useRouter } from "vue-router";
import { isEqual, isEmpty } from "lodash-unified"; import { isEqual, isEmpty } from "lodash-unified";
import { transformI18n, $t } from "/@/plugins/i18n"; import { toggleClass, removeClass } from "@pureadmin/utils";
import { RouteConfigs, tagsViewsType } from "../../types"; import { useResizeObserver, useDebounceFn } from "@vueuse/core";
import { useSettingStoreHook } from "/@/store/modules/settings"; import { useSettingStoreHook } from "/@/store/modules/settings";
import { handleAliveRoute, delAliveRoutes } from "/@/router/utils"; import { handleAliveRoute, delAliveRoutes } from "/@/router/utils";
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags"; import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "/@/store/modules/permission";
import { templateRef, useResizeObserver, useDebounceFn } from "@vueuse/core"; import { ref, watch, unref, toRaw, nextTick, onBeforeMount } from "vue";
import {
toggleClass,
removeClass,
hasClass,
storageLocal
} from "@pureadmin/utils";
const { t } = useI18n(); const {
const route = useRoute(); route,
const router = useRouter(); router,
const translateX = ref<number>(0); visible,
const activeIndex = ref<number>(-1); showTags,
let refreshButton = "refresh-button"; instance,
const instance = getCurrentInstance(); multiTags,
const pureSetting = useSettingStoreHook(); tagsViews,
const tabDom = templateRef<HTMLElement | null>("tabDom", null); buttonTop,
const containerDom = templateRef<HTMLElement | null>("containerDom", null); buttonLeft,
const scrollbarDom = templateRef<HTMLElement | null>("scrollbarDom", null); showModel,
const showTags = translateX,
ref(storageLocal.getItem<StorageConfigs>("responsive-configure").hideTabs) ?? activeIndex,
"false"; getTabStyle,
// @ts-expect-error iconIsActive,
let multiTags: ComputedRef<Array<RouteConfigs>> = computed(() => { linkIsActive,
return useMultiTagsStoreHook()?.multiTags; currentSelect,
}); scheduleIsActive,
getContextMenuStyle,
closeMenu,
onMounted,
onMouseenter,
onMouseleave,
transformI18n
} = useTags();
const linkIsActive = computed(() => { const tabDom = ref();
return item => { const containerDom = ref();
if (Object.keys(route.query).length === 0) { const scrollbarDom = ref();
if (route.path === item.path) {
return "is-active";
} else {
return "";
}
} else {
if (isEqual(route?.query, item?.query)) {
return "is-active";
} else {
return "";
}
}
};
});
const scheduleIsActive = computed(() => {
return item => {
if (Object.keys(route.query).length === 0) {
if (route.path === item.path) {
return "schedule-active";
} else {
return "";
}
} else {
if (isEqual(route?.query, item?.query)) {
return "schedule-active";
} else {
return "";
}
}
};
});
const iconIsActive = computed(() => {
return (item, index) => {
if (index === 0) return;
if (Object.keys(route.query).length === 0) {
if (route.path === item.path) {
return true;
} else {
return false;
}
} else {
if (isEqual(route?.query, item?.query)) {
return true;
} else {
return false;
}
}
};
});
const dynamicTagView = () => { const dynamicTagView = () => {
const index = multiTags.value.findIndex(item => { const index = multiTags.value.findIndex(item => {
if (item?.query) { if (item.query) {
return isEqual(route?.query, item?.query); return isEqual(route.query, item.query);
} else if (item.params) {
return isEqual(route.params, item.params);
} else { } else {
return item.path === route.path; return item.path === route.path;
} }
@@ -125,23 +55,9 @@ const dynamicTagView = () => {
moveToView(index); moveToView(index);
}; };
watch([route], () => {
activeIndex.value = -1;
dynamicTagView();
});
useResizeObserver(
scrollbarDom,
useDebounceFn(() => {
dynamicTagView();
}, 200)
);
const tabNavPadding = 10;
const moveToView = (index: number): void => { const moveToView = (index: number): void => {
if (!instance.refs["dynamic" + index]) { const tabNavPadding = 10;
return; if (!instance.refs["dynamic" + index]) return;
}
const tabItemEl = instance.refs["dynamic" + index][0]; const tabItemEl = instance.refs["dynamic" + index][0];
const tabItemElOffsetLeft = (tabItemEl as HTMLElement)?.offsetLeft; const tabItemElOffsetLeft = (tabItemEl as HTMLElement)?.offsetLeft;
const tabItemOffsetWidth = (tabItemEl as HTMLElement)?.offsetWidth; const tabItemOffsetWidth = (tabItemEl as HTMLElement)?.offsetWidth;
@@ -151,7 +67,6 @@ const moveToView = (index: number): void => {
: 0; : 0;
// 已有标签页总长度(包含溢出部分) // 已有标签页总长度(包含溢出部分)
const tabDomWidth = tabDom.value ? tabDom.value?.offsetWidth : 0; const tabDomWidth = tabDom.value ? tabDom.value?.offsetWidth : 0;
if (tabDomWidth < scrollbarDomWidth || tabItemElOffsetLeft === 0) { if (tabDomWidth < scrollbarDomWidth || tabItemElOffsetLeft === 0) {
translateX.value = 0; translateX.value = 0;
} else if (tabItemElOffsetLeft < -translateX.value) { } else if (tabItemElOffsetLeft < -translateX.value) {
@@ -200,71 +115,6 @@ const handleScroll = (offset: number): void => {
} }
}; };
const tagsViews = reactive<Array<tagsViewsType>>([
{
icon: refresh,
text: $t("buttons.hsreload"),
divided: false,
disabled: false,
show: true
},
{
icon: close,
text: $t("buttons.hscloseCurrentTab"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeLeft,
text: $t("buttons.hscloseLeftTabs"),
divided: true,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeRight,
text: $t("buttons.hscloseRightTabs"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeOther,
text: $t("buttons.hscloseOtherTabs"),
divided: true,
disabled: multiTags.value.length > 2 ? false : true,
show: true
},
{
icon: closeAll,
text: $t("buttons.hscloseAllTabs"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
}
]);
// 显示模式,默认灵动模式显示
const showModel = ref(
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showModel ||
"smart"
);
if (!showModel.value) {
const configure = storageLocal.getItem<StorageConfigs>(
"responsive-configure"
);
configure.showModel = "card";
storageLocal.setItem("responsive-configure", configure);
}
let visible = ref(false);
let buttonLeft = ref(0);
let buttonTop = ref(0);
// 当前右键选中的路由信息
let currentSelect = ref({});
function dynamicRouteTag(value: string, parentPath: string): void { function dynamicRouteTag(value: string, parentPath: string): void {
const hasValue = multiTags.value.some(item => { const hasValue = multiTags.value.some(item => {
return item.path === value; return item.path === value;
@@ -292,8 +142,9 @@ function dynamicRouteTag(value: string, parentPath: string): void {
concatPath(router.options.routes as any, value, parentPath); concatPath(router.options.routes as any, value, parentPath);
} }
// 重新加载 /** 刷新路由 */
function onFresh() { function onFresh() {
const refreshButton = "refresh-button";
toggleClass(true, refreshButton, document.querySelector(".rotate")); toggleClass(true, refreshButton, document.querySelector(".rotate"));
const { fullPath, query } = unref(route); const { fullPath, query } = unref(route);
router.replace({ router.replace({
@@ -313,6 +164,10 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
if (item.path === obj.path) { if (item.path === obj.path) {
return item.query === obj.query; return item.query === obj.query;
} }
} else if (item.params) {
if (item.path === obj.path) {
return item.params === obj.params;
}
} else { } else {
return item.path === obj.path; return item.path === obj.path;
} }
@@ -351,24 +206,25 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
: handleAliveRoute(route.matched, "delete"); : handleAliveRoute(route.matched, "delete");
// 如果删除当前激活tag就自动切换到最后一个tag // 如果删除当前激活tag就自动切换到最后一个tag
if (tag === "left") return; if (tag === "left") return;
nextTick(() => { if (newRoute[0]?.query) {
router.push({ router.push({ name: newRoute[0].name, query: newRoute[0].query });
path: newRoute[0].path, } else if (newRoute[0]?.params) {
query: newRoute[0].query router.push({ name: newRoute[0].name, params: newRoute[0].params });
}); } else {
}); router.push({ path: newRoute[0].path });
}
} else { } else {
// 删除缓存路由 // 删除缓存路由
tag ? delAliveRoutes(delAliveRouteList) : delAliveRoutes([obj]); tag ? delAliveRoutes(delAliveRouteList) : delAliveRoutes([obj]);
if (!multiTags.value.length) return; if (!multiTags.value.length) return;
let isHasActiveTag = multiTags.value.some(item => { if (multiTags.value.some(item => item.path === route.path)) return;
return item.path === route.path; if (newRoute[0]?.query) {
}); router.push({ name: newRoute[0].name, query: newRoute[0].query });
!isHasActiveTag && } else if (newRoute[0]?.params) {
router.push({ router.push({ name: newRoute[0].name, params: newRoute[0].params });
path: newRoute[0].path, } else {
query: newRoute[0].query router.push({ path: newRoute[0].path });
}); }
} }
} }
@@ -385,7 +241,8 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
path: selectRoute.path, path: selectRoute.path,
meta: selectRoute.meta, meta: selectRoute.meta,
name: selectRoute.name, name: selectRoute.name,
query: selectRoute.query query: selectRoute?.query,
params: selectRoute?.params
}; };
} else { } else {
selectTagRoute = { path: route.path, meta: route.meta }; selectTagRoute = { path: route.path, meta: route.meta };
@@ -394,7 +251,7 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
// 当前路由信息 // 当前路由信息
switch (key) { switch (key) {
case 0: case 0:
// 重新加载 // 刷新路由
onFresh(); onFresh();
break; break;
case 1: case 1:
@@ -433,15 +290,11 @@ function handleCommand(command: any) {
onClickDrop(key, item); onClickDrop(key, item);
} }
// 触发右键中菜单的点击事件 /** 触发右键中菜单的点击事件 */
function selectTag(key, item) { function selectTag(key, item) {
onClickDrop(key, item, currentSelect.value); onClickDrop(key, item, currentSelect.value);
} }
function closeMenu() {
visible.value = false;
}
function showMenus(value: boolean) { function showMenus(value: boolean) {
Array.of(1, 2, 3, 4, 5).forEach(v => { Array.of(1, 2, 3, 4, 5).forEach(v => {
tagsViews[v].show = value; tagsViews[v].show = value;
@@ -454,7 +307,7 @@ function disabledMenus(value: boolean) {
}); });
} }
// 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是首页,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 /** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是首页,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */
function showMenuModel( function showMenuModel(
currentPath: string, currentPath: string,
query: object = {}, query: object = {},
@@ -514,7 +367,7 @@ function openMenu(tag, e) {
// 右键菜单为首页,只显示刷新 // 右键菜单为首页,只显示刷新
showMenus(false); showMenus(false);
tagsViews[0].show = true; tagsViews[0].show = true;
} else if (route.path !== tag.path) { } else if (route.path !== tag.path && route.name !== tag.name) {
// 右键菜单不匹配当前路由,隐藏刷新 // 右键菜单不匹配当前路由,隐藏刷新
tagsViews[0].show = false; tagsViews[0].show = false;
showMenuModel(tag.path, tag.query); showMenuModel(tag.path, tag.query);
@@ -542,63 +395,36 @@ function openMenu(tag, e) {
} else { } else {
buttonLeft.value = left; buttonLeft.value = left;
} }
pureSetting.hiddenSideBar useSettingStoreHook().hiddenSideBar
? (buttonTop.value = e.clientY) ? (buttonTop.value = e.clientY)
: (buttonTop.value = e.clientY - 40); : (buttonTop.value = e.clientY - 40);
setTimeout(() => { nextTick(() => {
visible.value = true; visible.value = true;
}, 10);
}
// 触发tags标签切换
function tagOnClick(item) {
router.push({
path: item?.path,
query: item?.query
}); });
showMenuModel(item?.path, item?.query);
} }
// 鼠标移入 /** 触发tags标签切换 */
function onMouseenter(index) { function tagOnClick(item) {
if (index) activeIndex.value = index; const { name, path } = item;
if (unref(showModel) === "smart") { if (name) {
if (hasClass(instance.refs["schedule" + index][0], "schedule-active")) if (item.query) {
return; router.push({
toggleClass(true, "schedule-in", instance.refs["schedule" + index][0]); name,
toggleClass(false, "schedule-out", instance.refs["schedule" + index][0]); query: item.query
} else { });
if (hasClass(instance.refs["dynamic" + index][0], "card-active")) return; } else if (item.params) {
toggleClass(true, "card-in", instance.refs["dynamic" + index][0]); router.push({
toggleClass(false, "card-out", instance.refs["dynamic" + index][0]); name,
} params: item.params
} });
// 鼠标移出
function onMouseleave(index) {
activeIndex.value = -1;
if (unref(showModel) === "smart") {
if (hasClass(instance.refs["schedule" + index][0], "schedule-active"))
return;
toggleClass(false, "schedule-in", instance.refs["schedule" + index][0]);
toggleClass(true, "schedule-out", instance.refs["schedule" + index][0]);
} else {
if (hasClass(instance.refs["dynamic" + index][0], "card-active")) return;
toggleClass(false, "card-in", instance.refs["dynamic" + index][0]);
toggleClass(true, "card-out", instance.refs["dynamic" + index][0]);
}
}
watch(
() => visible.value,
val => {
if (val) {
document.body.addEventListener("click", closeMenu);
} else { } else {
document.body.removeEventListener("click", closeMenu); router.push({ name });
} }
} else {
router.push({ path });
} }
); // showMenuModel(item?.path, item?.query);
}
onBeforeMount(() => { onBeforeMount(() => {
if (!instance) return; if (!instance) return;
@@ -626,14 +452,18 @@ onBeforeMount(() => {
}); });
}); });
const getTabStyle = computed((): CSSProperties => { watch([route], () => {
return { activeIndex.value = -1;
transform: `translateX(${translateX.value}px)` dynamicTagView();
};
}); });
const getContextMenuStyle = computed((): CSSProperties => { onMounted(() => {
return { left: buttonLeft.value + "px", top: buttonTop.value + "px" }; useResizeObserver(
scrollbarDom,
useDebounceFn(() => {
dynamicTagView();
}, 200)
);
}); });
</script> </script>
@@ -705,7 +535,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
> >
<li v-if="item.show" @click="selectTag(key, item)"> <li v-if="item.show" @click="selectTag(key, item)">
<component :is="toRaw(item.icon)" :key="key" /> <component :is="toRaw(item.icon)" :key="key" />
{{ t(item.text) }} {{ transformI18n(item.text) }}
</li> </li>
</div> </div>
</ul> </ul>
@@ -714,7 +544,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
<ul class="right-button"> <ul class="right-button">
<li> <li>
<span <span
:title="t('buttons.hsrefreshRoute')" :title="transformI18n('buttons.hsrefreshRoute')"
class="el-icon-refresh-right rotate" class="el-icon-refresh-right rotate"
@click="onFresh" @click="onFresh"
> >
@@ -742,7 +572,7 @@ const getContextMenuStyle = computed((): CSSProperties => {
:key="key" :key="key"
style="margin-right: 6px" style="margin-right: 6px"
/> />
{{ t(item.text) }} {{ transformI18n(item.text) }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>

View File

@@ -13,7 +13,7 @@ import {
} from "@pureadmin/theme/dist/browser-utils"; } from "@pureadmin/theme/dist/browser-utils";
export function useDataThemeChange() { export function useDataThemeChange() {
const { layoutTheme } = useLayout(); const { layoutTheme, layout } = useLayout();
const themeColors = ref<Array<themeColorsType>>([ const themeColors = ref<Array<themeColorsType>>([
/* 道奇蓝(默认) */ /* 道奇蓝(默认) */
{ color: "#1b2a47", themeColor: "default" }, { color: "#1b2a47", themeColor: "default" },
@@ -36,7 +36,7 @@ export function useDataThemeChange() {
]); ]);
const { $storage } = useGlobal<GlobalPropertiesApi>(); const { $storage } = useGlobal<GlobalPropertiesApi>();
const dataTheme = ref<boolean>($storage?.layout?.darkMode);
const body = document.documentElement as HTMLElement; const body = document.documentElement as HTMLElement;
/** 设置导航主题色 */ /** 设置导航主题色 */
@@ -45,8 +45,13 @@ export function useDataThemeChange() {
toggleTheme({ toggleTheme({
scopeName: `layout-theme-${theme}` scopeName: `layout-theme-${theme}`
}); });
$storage.layout.theme = theme; $storage.layout = {
$storage.layout.darkMode = dataTheme.value; layout: layout.value,
theme,
darkMode: dataTheme.value,
sidebarStatus: $storage.layout?.sidebarStatus,
epThemeColor: $storage.layout?.epThemeColor
};
if (theme === "default" || theme === "light") { if (theme === "default" || theme === "light") {
setEpThemeColor(getConfig().EpThemeColor); setEpThemeColor(getConfig().EpThemeColor);
@@ -82,7 +87,6 @@ export function useDataThemeChange() {
); );
} }
}; };
const dataTheme = ref<boolean>($storage?.layout?.darkMode);
/** 日间、夜间主题切换 */ /** 日间、夜间主题切换 */
function dataThemeChange() { function dataThemeChange() {
@@ -94,10 +98,8 @@ export function useDataThemeChange() {
} }
if (dataTheme.value) { if (dataTheme.value) {
$storage.layout.darkMode = true;
document.documentElement.classList.add("dark"); document.documentElement.classList.add("dark");
} else { } else {
$storage.layout.darkMode = false;
document.documentElement.classList.remove("dark"); document.documentElement.classList.remove("dark");
} }
} }

218
src/layout/hooks/useTag.ts Normal file
View File

@@ -0,0 +1,218 @@
import {
ref,
unref,
watch,
computed,
reactive,
onMounted,
CSSProperties,
getCurrentInstance
} from "vue";
import { tagsViewsType } from "../types";
import { isEqual } from "lodash-unified";
import type { StorageConfigs } from "/#/index";
import { useEventListener } from "@vueuse/core";
import { useRoute, useRouter } from "vue-router";
import { transformI18n, $t } from "/@/plugins/i18n";
import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
import { storageLocal, toggleClass, hasClass } from "@pureadmin/utils";
import close from "/@/assets/svg/close.svg?component";
import refresh from "/@/assets/svg/refresh.svg?component";
import closeAll from "/@/assets/svg/close_all.svg?component";
import closeLeft from "/@/assets/svg/close_left.svg?component";
import closeOther from "/@/assets/svg/close_other.svg?component";
import closeRight from "/@/assets/svg/close_right.svg?component";
export function useTags() {
const route = useRoute();
const router = useRouter();
const instance = getCurrentInstance();
const buttonTop = ref(0);
const buttonLeft = ref(0);
const translateX = ref(0);
const visible = ref(false);
const activeIndex = ref(-1);
// 当前右键选中的路由信息
const currentSelect = ref({});
/** 显示模式,默认灵动模式 */
const showModel = ref(
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showModel ||
"smart"
);
/** 是否隐藏标签页,默认显示 */
const showTags =
ref(
storageLocal.getItem<StorageConfigs>("responsive-configure").hideTabs
) ?? ref("false");
const multiTags: any = computed(() => {
return useMultiTagsStoreHook().multiTags;
});
const tagsViews = reactive<Array<tagsViewsType>>([
{
icon: refresh,
text: $t("buttons.hsreload"),
divided: false,
disabled: false,
show: true
},
{
icon: close,
text: $t("buttons.hscloseCurrentTab"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeLeft,
text: $t("buttons.hscloseLeftTabs"),
divided: true,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeRight,
text: $t("buttons.hscloseRightTabs"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
},
{
icon: closeOther,
text: $t("buttons.hscloseOtherTabs"),
divided: true,
disabled: multiTags.value.length > 2 ? false : true,
show: true
},
{
icon: closeAll,
text: $t("buttons.hscloseAllTabs"),
divided: false,
disabled: multiTags.value.length > 1 ? false : true,
show: true
}
]);
function conditionHandle(item, previous, next) {
if (
Object.keys(route.query).length === 0 &&
Object.keys(route.params).length === 0
) {
return route.path === item.path ? previous : next;
} else if (Object.keys(route.query).length > 0) {
return isEqual(route.query, item.query) ? previous : next;
} else {
return isEqual(route.params, item.params) ? previous : next;
}
}
const iconIsActive = computed(() => {
return (item, index) => {
if (index === 0) return;
return conditionHandle(item, true, false);
};
});
const linkIsActive = computed(() => {
return item => {
return conditionHandle(item, "is-active", "");
};
});
const scheduleIsActive = computed(() => {
return item => {
return conditionHandle(item, "schedule-active", "");
};
});
const getTabStyle = computed((): CSSProperties => {
return {
transform: `translateX(${translateX.value}px)`
};
});
const getContextMenuStyle = computed((): CSSProperties => {
return { left: buttonLeft.value + "px", top: buttonTop.value + "px" };
});
const closeMenu = () => {
visible.value = false;
};
/** 鼠标移入添加激活样式 */
function onMouseenter(index) {
if (index) activeIndex.value = index;
if (unref(showModel) === "smart") {
if (hasClass(instance.refs["schedule" + index][0], "schedule-active"))
return;
toggleClass(true, "schedule-in", instance.refs["schedule" + index][0]);
toggleClass(false, "schedule-out", instance.refs["schedule" + index][0]);
} else {
if (hasClass(instance.refs["dynamic" + index][0], "card-active")) return;
toggleClass(true, "card-in", instance.refs["dynamic" + index][0]);
toggleClass(false, "card-out", instance.refs["dynamic" + index][0]);
}
}
/** 鼠标移出恢复默认样式 */
function onMouseleave(index) {
activeIndex.value = -1;
if (unref(showModel) === "smart") {
if (hasClass(instance.refs["schedule" + index][0], "schedule-active"))
return;
toggleClass(false, "schedule-in", instance.refs["schedule" + index][0]);
toggleClass(true, "schedule-out", instance.refs["schedule" + index][0]);
} else {
if (hasClass(instance.refs["dynamic" + index][0], "card-active")) return;
toggleClass(false, "card-in", instance.refs["dynamic" + index][0]);
toggleClass(true, "card-out", instance.refs["dynamic" + index][0]);
}
}
onMounted(() => {
if (!showModel.value) {
const configure = storageLocal.getItem<StorageConfigs>(
"responsive-configure"
);
configure.showModel = "card";
storageLocal.setItem("responsive-configure", configure);
}
});
watch(
() => visible.value,
() => {
useEventListener(document, "click", closeMenu);
}
);
return {
route,
router,
visible,
showTags,
instance,
multiTags,
showModel,
tagsViews,
buttonTop,
buttonLeft,
translateX,
activeIndex,
getTabStyle,
iconIsActive,
linkIsActive,
currentSelect,
scheduleIsActive,
getContextMenuStyle,
$t,
closeMenu,
onMounted,
onMouseenter,
onMouseleave,
transformI18n
};
}

View File

@@ -22,6 +22,7 @@ export type RouteConfigs = {
path?: string; path?: string;
parentPath?: string; parentPath?: string;
query?: object; query?: object;
params?: object;
meta?: routeMetaType; meta?: routeMetaType;
children?: RouteConfigs[]; children?: RouteConfigs[];
name?: string; name?: string;

View File

@@ -8,17 +8,14 @@ import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "/@/store/modules/permission";
import { import {
Router, Router,
RouteMeta,
createRouter, createRouter,
RouteRecordRaw, RouteRecordRaw,
RouteComponent, RouteComponent
RouteRecordName
} from "vue-router"; } from "vue-router";
import { import {
ascending, ascending,
initRouter, initRouter,
getHistoryMode, getHistoryMode,
getParentPaths,
findRouteByPath, findRouteByPath,
handleAliveRoute, handleAliveRoute,
formatTwoStageRoutes, formatTwoStageRoutes,
@@ -148,69 +145,22 @@ router.beforeEach((to: toRouteType, _from, next) => {
if (usePermissionStoreHook().wholeMenus.length === 0) if (usePermissionStoreHook().wholeMenus.length === 0)
initRouter(name.username).then((router: Router) => { initRouter(name.username).then((router: Router) => {
if (!useMultiTagsStoreHook().getMultiTagsCache) { if (!useMultiTagsStoreHook().getMultiTagsCache) {
const handTag = ( const { path } = to;
path: string, const index = findIndex(remainingRouter, v => {
parentPath: string, return v.path == path;
name: RouteRecordName, });
meta: RouteMeta const routes: any =
): void => { index === -1
? router.options.routes[0].children
: router.options.routes;
const route = findRouteByPath(path, routes);
// query、params模式路由传参数的标签页不在此处处理
if (route && route.meta?.title) {
useMultiTagsStoreHook().handleTags("push", { useMultiTagsStoreHook().handleTags("push", {
path, path: route.path,
parentPath, name: route.name,
name, meta: route.meta
meta
}); });
};
// 未开启标签页缓存,刷新页面重定向到顶级路由(参考标签页操作例子,只针对静态路由)
if (to.meta?.refreshRedirect) {
const routes: any = router.options.routes;
const { refreshRedirect } = to.meta;
const { name, meta } = findRouteByPath(refreshRedirect, routes);
handTag(
refreshRedirect,
getParentPaths(refreshRedirect, routes)[1],
name,
meta
);
return router.push(refreshRedirect);
} else {
const { path } = to;
const index = findIndex(remainingRouter, v => {
return v.path == path;
});
const routes: any =
index === -1
? router.options.routes[0].children
: router.options.routes;
const route = findRouteByPath(path, routes);
const routePartent = getParentPaths(path, routes);
// 未开启标签页缓存,刷新页面重定向到顶级路由(参考标签页操作例子,只针对动态路由)
if (
path !== routes[0].path &&
route?.meta?.rank !== 0 &&
routePartent.length === 0
) {
if (!route?.meta?.refreshRedirect) return;
const { name, meta } = findRouteByPath(
route.meta.refreshRedirect,
routes
);
handTag(
route.meta?.refreshRedirect,
getParentPaths(route.meta?.refreshRedirect, routes)[0],
name,
meta
);
return router.push(route.meta?.refreshRedirect);
} else {
handTag(
route.path,
routePartent[routePartent.length - 1],
route.name,
route.meta
);
return router.push(path);
}
} }
} }
router.push(to.fullPath); router.push(to.fullPath);

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const ableRouter: RouteConfigsTable = { const ableRouter: RouteConfigsTable = {
path: "/able", path: "/able",
component: Layout,
redirect: "/able/watermark", redirect: "/able/watermark",
meta: { meta: {
icon: "ubuntu-fill", icon: "ubuntu-fill",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const aboutRouter: RouteConfigsTable = { const aboutRouter: RouteConfigsTable = {
path: "/about", path: "/about",
component: Layout,
redirect: "/about/index", redirect: "/about/index",
meta: { meta: {
// icon: "question-line", // icon: "question-line",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const componentsRouter: RouteConfigsTable = { const componentsRouter: RouteConfigsTable = {
path: "/components", path: "/components",
component: Layout,
redirect: "/components/video", redirect: "/components/video",
meta: { meta: {
icon: "menu", icon: "menu",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const editorRouter: RouteConfigsTable = { const editorRouter: RouteConfigsTable = {
path: "/editor", path: "/editor",
component: Layout,
redirect: "/editor/index", redirect: "/editor/index",
meta: { meta: {
icon: "edit", icon: "edit",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const errorRouter: RouteConfigsTable = { const errorRouter: RouteConfigsTable = {
path: "/error", path: "/error",
component: Layout,
redirect: "/error/403", redirect: "/error/403",
meta: { meta: {
icon: "information-line", icon: "information-line",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const flowChartRouter: RouteConfigsTable = { const flowChartRouter: RouteConfigsTable = {
path: "/flowChart", path: "/flowChart",
component: Layout,
redirect: "/flowChart/index", redirect: "/flowChart/index",
meta: { meta: {
icon: "set-up", icon: "set-up",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const formDesignRouter: RouteConfigsTable = { const formDesignRouter: RouteConfigsTable = {
path: "/formDesign", path: "/formDesign",
component: Layout,
redirect: "/formDesign/index", redirect: "/formDesign/index",
meta: { meta: {
icon: "terminal-window-line", icon: "terminal-window-line",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const guideRouter: RouteConfigsTable = { const guideRouter: RouteConfigsTable = {
path: "/guide", path: "/guide",
component: Layout,
redirect: "/guide/index", redirect: "/guide/index",
meta: { meta: {
icon: "guide", icon: "guide",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const ableRouter: RouteConfigsTable = { const ableRouter: RouteConfigsTable = {
path: "/list", path: "/list",
component: Layout,
redirect: "/list/card", redirect: "/list/card",
meta: { meta: {
icon: "list-check", icon: "list-check",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const nestedRouter: RouteConfigsTable = { const nestedRouter: RouteConfigsTable = {
path: "/nested", path: "/nested",
component: Layout,
redirect: "/nested/menu1/menu1-1", redirect: "/nested/menu1/menu1-1",
meta: { meta: {
title: $t("menus.hsmenus"), title: $t("menus.hsmenus"),

View File

@@ -1,10 +1,8 @@
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const IFrame = () => import("/@/layout/frameView.vue"); const IFrame = () => import("/@/layout/frameView.vue");
const pptRouter: RouteConfigsTable = { const pptRouter: RouteConfigsTable = {
path: "/ppt", path: "/ppt",
component: Layout,
redirect: "/ppt/index", redirect: "/ppt/index",
meta: { meta: {
icon: "ppt", icon: "ppt",

View File

@@ -1,10 +1,8 @@
import { $t } from "/@/plugins/i18n"; import { $t } from "/@/plugins/i18n";
import type { RouteConfigsTable } from "/#/index"; import type { RouteConfigsTable } from "/#/index";
const Layout = () => import("/@/layout/index.vue");
const resultRouter: RouteConfigsTable = { const resultRouter: RouteConfigsTable = {
path: "/result", path: "/result",
component: Layout,
redirect: "/result/success", redirect: "/result/success",
meta: { meta: {
icon: "checkbox-circle-line", icon: "checkbox-circle-line",

View File

@@ -3,7 +3,6 @@ import { RouteLocationNormalized } from "vue-router";
export interface toRouteType extends RouteLocationNormalized { export interface toRouteType extends RouteLocationNormalized {
meta: { meta: {
keepAlive?: boolean; keepAlive?: boolean;
refreshRedirect: string;
dynamicLevel?: string; dynamicLevel?: string;
}; };
} }

View File

@@ -7,13 +7,13 @@ import {
RouteRecordNormalized RouteRecordNormalized
} from "vue-router"; } from "vue-router";
import { router } from "./index"; import { router } from "./index";
import { isProxy, toRaw } from "vue";
import { loadEnv } from "../../build"; import { loadEnv } from "../../build";
import { cloneDeep } from "lodash-unified"; import { cloneDeep } from "lodash-unified";
import { useTimeoutFn } from "@vueuse/core"; import { useTimeoutFn } from "@vueuse/core";
import { RouteConfigs } from "/@/layout/types"; import { RouteConfigs } from "/@/layout/types";
import { buildHierarchyTree } from "@pureadmin/utils"; import { buildHierarchyTree } from "@pureadmin/utils";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "/@/store/modules/permission";
const Layout = () => import("/@/layout/index.vue");
const IFrame = () => import("/@/layout/frameView.vue"); const IFrame = () => import("/@/layout/frameView.vue");
// https://cn.vitejs.dev/guide/features.html#glob-import // https://cn.vitejs.dev/guide/features.html#glob-import
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}"); const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
@@ -87,7 +87,7 @@ function getParentPaths(path: string, routes: RouteRecordRaw[]) {
function findRouteByPath(path: string, routes: RouteRecordRaw[]) { function findRouteByPath(path: string, routes: RouteRecordRaw[]) {
let res = routes.find((item: { path: string }) => item.path == path); let res = routes.find((item: { path: string }) => item.path == path);
if (res) { if (res) {
return res; return isProxy(res) ? toRaw(res) : res;
} else { } else {
for (let i = 0; i < routes.length; i++) { for (let i = 0; i < routes.length; i++) {
if ( if (
@@ -96,7 +96,7 @@ function findRouteByPath(path: string, routes: RouteRecordRaw[]) {
) { ) {
res = findRouteByPath(path, routes[i].children); res = findRouteByPath(path, routes[i].children);
if (res) { if (res) {
return res; return isProxy(res) ? toRaw(res) : res;
} }
} }
} }
@@ -229,17 +229,16 @@ function addAsyncRoutes(arrRoutes: Array<RouteRecordRaw>) {
arrRoutes.forEach((v: RouteRecordRaw) => { arrRoutes.forEach((v: RouteRecordRaw) => {
// 将backstage属性加入meta标识此路由为后端返回路由 // 将backstage属性加入meta标识此路由为后端返回路由
v.meta.backstage = true; v.meta.backstage = true;
if (v.redirect) { // 父级的redirect属性取值如果子级存在且父级的redirect属性不存在默认取第一个子级的path如果子级存在且父级的redirect属性存在取存在的redirect属性会覆盖默认值
v.component = Layout; if (v?.children && !v.redirect) v.redirect = v.children[0].path;
} else if (v.meta?.frameSrc) { // 父级的name属性取值如果子级存在且父级的name属性不存在默认取第一个子级的name如果子级存在且父级的name属性存在取存在的name属性会覆盖默认值
v.component = IFrame; if (v?.children && !v.name) v.name = v.children[0].name;
} else { if (v.meta?.frameSrc) v.component = IFrame;
// 对后端传component组件路径和不传做兼容如果后端传component组件路径那么path可以随便写如果不传component组件路径会path保持一致 // 对后端传component组件路径和不传做兼容如果后端传component组件路径那么path可以随便写如果不传component组件路径会path保持一致
const index = v?.component const index = v?.component
? modulesRoutesKeys.findIndex(ev => ev.includes(v.component as any)) ? modulesRoutesKeys.findIndex(ev => ev.includes(v.component as any))
: modulesRoutesKeys.findIndex(ev => ev.includes(v.path)); : modulesRoutesKeys.findIndex(ev => ev.includes(v.path));
v.component = modulesRoutes[modulesRoutesKeys[index]]; v.component = modulesRoutes[modulesRoutesKeys[index]];
}
if (v.children) { if (v.children) {
addAsyncRoutes(v.children); addAsyncRoutes(v.children);
} }

View File

@@ -48,9 +48,13 @@ export const useMultiTagsStore = defineStore({
case "push": case "push":
{ {
const tagVal = value as multiType; const tagVal = value as multiType;
// 不添加到标签页
if (tagVal?.meta?.hiddenTag) return;
// 如果是外链无需添加信息到标签页
if (isUrl(tagVal?.name)) return; if (isUrl(tagVal?.name)) return;
// 如果title为空拒绝添加空信息到标签页
if (tagVal?.meta?.title.length === 0) return; if (tagVal?.meta?.title.length === 0) return;
const tagPath = tagVal?.path; const tagPath = tagVal.path;
// 判断tag是否已存在 // 判断tag是否已存在
const tagHasExits = this.multiTags.some(tag => { const tagHasExits = this.multiTags.some(tag => {
return tag.path === tagPath; return tag.path === tagPath;
@@ -58,20 +62,24 @@ export const useMultiTagsStore = defineStore({
// 判断tag中的query键值是否相等 // 判断tag中的query键值是否相等
const tagQueryHasExits = this.multiTags.some(tag => { const tagQueryHasExits = this.multiTags.some(tag => {
return isEqual(tag.query, tagVal?.query); return isEqual(tag?.query, tagVal?.query);
}); });
if (tagHasExits && tagQueryHasExits) return; // 判断tag中的params键值是否相等
const tagParamsHasExits = this.multiTags.some(tag => {
return isEqual(tag?.params, tagVal?.params);
});
if (tagHasExits && tagQueryHasExits && tagParamsHasExits) return;
// 动态路由可打开的最大数量
const dynamicLevel = tagVal?.meta?.dynamicLevel ?? -1; const dynamicLevel = tagVal?.meta?.dynamicLevel ?? -1;
if (dynamicLevel > 0) { if (dynamicLevel > 0) {
// dynamicLevel动态路由可打开的数量
// 获取到已经打开的动态路由数, 判断是否大于dynamicLevel
if ( if (
this.multiTags.filter(e => e?.path === tagPath).length >= this.multiTags.filter(e => e?.path === tagPath).length >=
dynamicLevel dynamicLevel
) { ) {
// 关闭第一个 // 如果当前已打开的动态路由数大于dynamicLevel替换第一个动态路由标签
const index = this.multiTags.findIndex( const index = this.multiTags.findIndex(
item => item?.path === tagPath item => item?.path === tagPath
); );

View File

@@ -27,6 +27,7 @@ export type multiType = {
name: string; name: string;
meta: any; meta: any;
query?: object; query?: object;
params?: object;
}; };
export type setType = { export type setType = {

View File

@@ -51,7 +51,7 @@ export function useColumns() {
label: "QQ交流群", label: "QQ交流群",
cellRenderer: () => { cellRenderer: () => {
return ( return (
<a href="https://jq.qq.com/?_wv=1027&k=HntMx0dt" target="_blank"> <a href="https://jq.qq.com/?_wv=1027&k=E9fwmFGr" target="_blank">
<span style="color: var(--el-color-primary)"> <span style="color: var(--el-color-primary)">
Pure Admin Pure Admin
</span> </span>

View File

@@ -5,26 +5,48 @@ import { onBeforeMount } from "vue";
export function useDetail() { export function useDetail() {
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const id = route.query?.id ?? -1; const id = route.query?.id ? route.query?.id : route.params?.id;
function toDetail(index: number | string | string[] | number[]) { function toDetail(
useMultiTagsStoreHook().handleTags("push", { index: number | string | string[] | number[],
path: `/tabs/detail`, model: string
parentPath: route.matched[0].path, ) {
name: "TabDetail", if (model === "query") {
query: { id: String(index) }, // 保存信息到标签页
meta: { useMultiTagsStoreHook().handleTags("push", {
title: { zh: `No.${index} - 详情信息`, en: `No.${index} - DetailInfo` }, path: `/tabs/query-detail`,
showLink: false, name: "TabQueryDetail",
dynamicLevel: 3 query: { id: String(index) },
} meta: {
}); title: {
router.push({ name: "TabDetail", query: { id: String(index) } }); zh: `No.${index} - 详情信息`,
en: `No.${index} - DetailInfo`
},
// 最大打开标签数
dynamicLevel: 3
}
});
// 路由跳转
router.push({ name: "TabQueryDetail", query: { id: String(index) } });
} else {
useMultiTagsStoreHook().handleTags("push", {
path: `/tabs/params-detail/:id`,
name: "TabParamsDetail",
params: { id: String(index) },
meta: {
title: {
zh: `No.${index} - 详情信息`,
en: `No.${index} - DetailInfo`
}
}
});
router.push({ name: "TabParamsDetail", params: { id: String(index) } });
}
} }
function initToDetail() { function initToDetail(model) {
onBeforeMount(() => { onBeforeMount(() => {
if (id) toDetail(id); if (id) toDetail(id, model);
}); });
} }

View File

@@ -6,8 +6,8 @@ import { useMultiTagsStoreHook } from "/@/store/modules/multiTags";
import { usePermissionStoreHook } from "/@/store/modules/permission"; import { usePermissionStoreHook } from "/@/store/modules/permission";
import { import {
deleteChildren, deleteChildren,
appendFieldByUniqueId, getNodeByUniqueId,
getNodeByUniqueId appendFieldByUniqueId
} from "@pureadmin/utils"; } from "@pureadmin/utils";
import { useDetail } from "./hooks"; import { useDetail } from "./hooks";
@@ -50,9 +50,32 @@ function onCloseTags() {
<template #header> <template #header>
<div>标签页复用超出限制自动关闭使用场景: 动态路由</div> <div>标签页复用超出限制自动关闭使用场景: 动态路由</div>
</template> </template>
<el-button v-for="index in 6" :key="index" @click="toDetail(index)"> <div class="flex-wrap items-center">
打开{{ index }}详情页 <p>query传参模式</p>
</el-button> <el-button
class="m-2"
v-for="index in 6"
:key="index"
@click="toDetail(index, 'query')"
>
打开{{ index }}详情页
</el-button>
</div>
<el-divider />
<div class="flex-wrap items-center">
<p>params传参模式</p>
<el-button
class="m-2"
v-for="index in 6"
:key="index"
@click="toDetail(index, 'params')"
>
打开{{ index }}详情页
</el-button>
</div>
<el-divider /> <el-divider />
<TreeSelect <TreeSelect
class="w-300px" class="w-300px"
@@ -80,19 +103,27 @@ function onCloseTags() {
<span>{{ transformI18n(data.meta.title) }}</span> <span>{{ transformI18n(data.meta.title) }}</span>
</template> </template>
</TreeSelect> </TreeSelect>
<el-button class="ml-2" @click="onCloseTags">关闭标签</el-button> <el-button class="m-2" @click="onCloseTags">关闭标签</el-button>
<br />
<p class="mt-4"> <el-divider />
注意此demo并未开启标签页缓存如果需要在 <el-button @click="$router.push({ name: 'Menu1-2-2' })">
<span class="text-red-500">刷新页面</span> 跳转页内菜单传name对象优先推荐
的时候同时 </el-button>
<span class="text-red-500">保留标签页的显示</span> <el-button @click="$router.push('/nested/menu1/menu1-2/menu1-2-2')">
或者 跳转页内菜单直接传要跳转的路径
<span class="text-red-500">保留url的参数</span> </el-button>
那么就需要开启标签页持久化 <el-button
<br /> @click="$router.push({ path: '/nested/menu1/menu1-2/menu1-2-2' })"
开启方式在页面最右上角有个设置的小图标点进去会看到项目配置面板找到标签页持久化开启即可 >
</p> 跳转页内菜单传path对象
</el-button>
<el-link
class="ml-4"
href="https://router.vuejs.org/zh/guide/essentials/navigation.html#%E5%AF%BC%E8%88%AA%E5%88%B0%E4%B8%8D%E5%90%8C%E7%9A%84%E4%BD%8D%E7%BD%AE"
target="_blank"
>
点击查看更多跳转方式
</el-link>
<el-divider /> <el-divider />
<el-button @click="$router.push({ name: 'Empty' })"> <el-button @click="$router.push({ name: 'Empty' })">

View File

@@ -0,0 +1,14 @@
<script setup lang="ts">
import { useDetail } from "./hooks";
defineOptions({
name: "TabParamsDetail"
});
const { initToDetail, id } = useDetail();
initToDetail("params");
</script>
<template>
<div>{{ id }} - 详情页内容在此params传参</div>
</template>

View File

@@ -2,13 +2,13 @@
import { useDetail } from "./hooks"; import { useDetail } from "./hooks";
defineOptions({ defineOptions({
name: "TabDetail" name: "TabQueryDetail"
}); });
const { initToDetail, id } = useDetail(); const { initToDetail, id } = useDetail();
initToDetail(); initToDetail("query");
</script> </script>
<template> <template>
<div>{{ id }} - 详情页内容在此</div> <div>{{ id }} - 详情页内容在此query传参</div>
</template> </template>

View File

@@ -54,7 +54,7 @@ export interface ResponsiveStorage {
export interface RouteChildrenConfigsTable { export interface RouteChildrenConfigsTable {
/** 子路由地址 `必填` */ /** 子路由地址 `必填` */
path: string; path: string;
/** 路由名字(对应不要重复,当前组件的`name`保持一致)`必填` */ /** 路由名字(对应不要重复,当前组件的`name`保持一致)`必填` */
name?: string; name?: string;
/** 路由重定向 `可选` */ /** 路由重定向 `可选` */
redirect?: string; redirect?: string;
@@ -94,10 +94,10 @@ export interface RouteChildrenConfigsTable {
/** 离场动画 */ /** 离场动画 */
leaveTransition?: string; leaveTransition?: string;
}; };
// 是否不添加信息到标签页,(默认`false`
hiddenTag?: boolean;
/** 动态路由可打开的最大数量 `可选` */ /** 动态路由可打开的最大数量 `可选` */
dynamicLevel?: number; dynamicLevel?: number;
/** 刷新重定向(用于未开启标签页缓存,刷新页面获取不到动态`title``可选` */
refreshRedirect?: string;
}; };
/** 子路由配置项 */ /** 子路由配置项 */
children?: Array<RouteChildrenConfigsTable>; children?: Array<RouteChildrenConfigsTable>;

View File

@@ -38,7 +38,7 @@ export default defineConfig({
shortcuts: { shortcuts: {
"bg-dark": "bg-bg_color", "bg-dark": "bg-bg_color",
"wh-full": "w-full h-full", "wh-full": "w-full h-full",
"cp-on": "cursor-pointer outline-none", "flex-wrap": "flex flex-wrap",
"flex-c": "flex justify-center items-center", "flex-c": "flex justify-center items-center",
"flex-ac": "flex justify-around items-center", "flex-ac": "flex justify-around items-center",
"flex-bc": "flex justify-between items-center", "flex-bc": "flex justify-between items-center",