更新 vuetify 和 vite-plugin-vuetify 版本,优化 PathInput 组件的状态管理

This commit is contained in:
jxxghp
2025-01-15 19:24:36 +08:00
parent 1a3d76d7b9
commit 2cf5535376
5 changed files with 16 additions and 28 deletions
+2 -2
View File
@@ -51,7 +51,7 @@
"vue3-apexcharts": "^1.4.1", "vue3-apexcharts": "^1.4.1",
"vue3-perfect-scrollbar": "^2.0.0", "vue3-perfect-scrollbar": "^2.0.0",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"vuetify": "3.6.8", "vuetify": "3.7.3",
"vuetify-use-dialog": "^0.6.11", "vuetify-use-dialog": "^0.6.11",
"vuex": "^4.1.0", "vuex": "^4.1.0",
"vuex-persistedstate": "^4.1.0", "vuex-persistedstate": "^4.1.0",
@@ -96,7 +96,7 @@
"vite-plugin-pages": "^0.32.1", "vite-plugin-pages": "^0.32.1",
"vite-plugin-pwa": "^0.20.0", "vite-plugin-pwa": "^0.20.0",
"vite-plugin-vue-layouts": "^0.11.0", "vite-plugin-vue-layouts": "^0.11.0",
"vite-plugin-vuetify": "2.0.3", "vite-plugin-vuetify": "2.0.4",
"vue-shepherd": "^3.0.0", "vue-shepherd": "^3.0.0",
"vue-tsc": "^2.0.10" "vue-tsc": "^2.0.10"
}, },
+3 -14
View File
@@ -16,9 +16,7 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const activedDirs = ref<string[]>([]) const activedDirs = ref<Record<string, any>[]>([])
const openedDirs = ref<string[]>([])
const isUserAction = ref(false) // 标志:是否为用户主动操作
const treeItems = ref<FileItem[]>([ const treeItems = ref<FileItem[]>([
{ {
@@ -43,15 +41,14 @@ async function fetchDirs(item: any) {
const selectedPath = computed(() => { const selectedPath = computed(() => {
if (activedDirs.value.length > 0) { if (activedDirs.value.length > 0) {
return activedDirs.value[0] return activedDirs.value[0].path
} }
return '' return ''
}) })
watch(activedDirs, newVal => { watch(activedDirs, newVal => {
if (!newVal.length || !isUserAction.value) return if (!newVal.length) return
emit('update:modelValue', selectedPath.value) emit('update:modelValue', selectedPath.value)
isUserAction.value = false
}) })
watch( watch(
@@ -67,14 +64,9 @@ watch(
storage: newVal, storage: newVal,
}, },
] ]
openedDirs.value = []
activedDirs.value = [] activedDirs.value = []
}, },
) )
function handleUserSelect() {
isUserAction.value = true
}
</script> </script>
<template> <template>
@@ -85,19 +77,16 @@ function handleUserSelect() {
</template> </template>
<VTreeview <VTreeview
v-model:activated="activedDirs" v-model:activated="activedDirs"
v-model:opened="openedDirs"
:items="treeItems" :items="treeItems"
:load-children="fetchDirs" :load-children="fetchDirs"
item-key="path" item-key="path"
item-title="name" item-title="name"
item-value="path" item-value="path"
item-type="unknown"
activatable activatable
return-object return-object
max-height="20rem" max-height="20rem"
expand-icon="mdi-folder" expand-icon="mdi-folder"
collapse-icon="mdi-folder-open" collapse-icon="mdi-folder-open"
@update:activated="handleUserSelect"
/> />
</VMenu> </VMenu>
</div> </div>
+1
View File
@@ -38,6 +38,7 @@ import MediaIdSelector from './components/misc/MediaIdSelector.vue'
import CronField from './components/field/CronField.vue' import CronField from './components/field/CronField.vue'
// 7. 样式文件 // 7. 样式文件
import '@core/scss/template/libs/vuetify/index.scss'
import 'vuetify/styles' import 'vuetify/styles'
import '@core/scss/template/index.scss' import '@core/scss/template/index.scss'
import '@layouts/styles/index.scss' import '@layouts/styles/index.scss'
-4
View File
@@ -6,10 +6,6 @@ import defaults from './defaults'
import { icons } from './icons' import { icons } from './icons'
import theme from './theme' import theme from './theme'
// Styles
import '@core/scss/template/libs/vuetify/index.scss'
import 'vuetify/styles'
export default createVuetify({ export default createVuetify({
aliases: { aliases: {
IconBtn: VBtn, IconBtn: VBtn,
+10 -8
View File
@@ -6639,6 +6639,7 @@ stop-iteration-iterator@^1.0.0:
internal-slot "^1.0.4" internal-slot "^1.0.4"
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.3: "string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.3:
name string-width-cjs
version "4.2.3" version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -6712,6 +6713,7 @@ stringify-object@^3.3.0:
is-regexp "^1.0.0" is-regexp "^1.0.0"
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
name strip-ansi-cjs
version "6.0.1" version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -7510,10 +7512,10 @@ vite-plugin-vue-layouts@^0.11.0:
debug "^4.3.4" debug "^4.3.4"
fast-glob "^3.3.2" fast-glob "^3.3.2"
vite-plugin-vuetify@2.0.3: vite-plugin-vuetify@2.0.4:
version "2.0.3" version "2.0.4"
resolved "https://registry.yarnpkg.com/vite-plugin-vuetify/-/vite-plugin-vuetify-2.0.3.tgz#b65ee4e05cfc6bf2b478a32b6d58b42398519f1e" resolved "https://registry.yarnpkg.com/vite-plugin-vuetify/-/vite-plugin-vuetify-2.0.4.tgz#9beb700ee50da58d83399721d6cf4b0af83202d5"
integrity sha512-HbYajgGgb/noaVKNRhnnXIiQZrNXfNIeanUGAwXgOxL6h/KULS40Uf51Kyz8hNmdegF+DwjgXXI/8J1PNS83xw== integrity sha512-A4cliYUoP/u4AWSRVRvAPKgpgR987Pss7LpFa7s1GvOe8WjgDq92Rt3eVXrvgxGCWvZsPKziVqfHHdCMqeDhfw==
dependencies: dependencies:
"@vuetify/loader-shared" "^2.0.3" "@vuetify/loader-shared" "^2.0.3"
debug "^4.3.3" debug "^4.3.3"
@@ -7628,10 +7630,10 @@ vuetify-use-dialog@^0.6.11:
dependencies: dependencies:
defu "^6.1.4" defu "^6.1.4"
vuetify@3.6.8: vuetify@3.7.3:
version "3.6.8" version "3.7.3"
resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-3.6.8.tgz#89ab0b68aa5488c7b54a04fa4a02a1b802892aaa" resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-3.7.3.tgz#0e89f7f0298d452510bcbc01b0e9b53a5ce6e883"
integrity sha512-j0v0iTeSVRj2ZEM9Q8HxejHxmxrQLYQSalhH82hfcraORaiDoqf1XV05N3P5ERXkKiJjJc/LfxFAUUvYSldxeg== integrity sha512-bpuvBpZl1/+nLlXDgdVXekvMNR6W/ciaoa8CYlpeAzAARbY8zUFSoBq05JlLhkIHI58AnzKVy4c09d0OtfYAPg==
vuetify@^3.4.0: vuetify@^3.4.0:
version "3.7.6" version "3.7.6"