更新 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

View File

@@ -51,7 +51,7 @@
"vue3-apexcharts": "^1.4.1",
"vue3-perfect-scrollbar": "^2.0.0",
"vuedraggable": "^4.1.0",
"vuetify": "3.6.8",
"vuetify": "3.7.3",
"vuetify-use-dialog": "^0.6.11",
"vuex": "^4.1.0",
"vuex-persistedstate": "^4.1.0",
@@ -96,7 +96,7 @@
"vite-plugin-pages": "^0.32.1",
"vite-plugin-pwa": "^0.20.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-tsc": "^2.0.10"
},

View File

@@ -16,9 +16,7 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue'])
const activedDirs = ref<string[]>([])
const openedDirs = ref<string[]>([])
const isUserAction = ref(false) // 标志:是否为用户主动操作
const activedDirs = ref<Record<string, any>[]>([])
const treeItems = ref<FileItem[]>([
{
@@ -43,15 +41,14 @@ async function fetchDirs(item: any) {
const selectedPath = computed(() => {
if (activedDirs.value.length > 0) {
return activedDirs.value[0]
return activedDirs.value[0].path
}
return ''
})
watch(activedDirs, newVal => {
if (!newVal.length || !isUserAction.value) return
if (!newVal.length) return
emit('update:modelValue', selectedPath.value)
isUserAction.value = false
})
watch(
@@ -67,14 +64,9 @@ watch(
storage: newVal,
},
]
openedDirs.value = []
activedDirs.value = []
},
)
function handleUserSelect() {
isUserAction.value = true
}
</script>
<template>
@@ -85,19 +77,16 @@ function handleUserSelect() {
</template>
<VTreeview
v-model:activated="activedDirs"
v-model:opened="openedDirs"
:items="treeItems"
:load-children="fetchDirs"
item-key="path"
item-title="name"
item-value="path"
item-type="unknown"
activatable
return-object
max-height="20rem"
expand-icon="mdi-folder"
collapse-icon="mdi-folder-open"
@update:activated="handleUserSelect"
/>
</VMenu>
</div>

View File

@@ -38,6 +38,7 @@ import MediaIdSelector from './components/misc/MediaIdSelector.vue'
import CronField from './components/field/CronField.vue'
// 7. 样式文件
import '@core/scss/template/libs/vuetify/index.scss'
import 'vuetify/styles'
import '@core/scss/template/index.scss'
import '@layouts/styles/index.scss'

View File

@@ -6,10 +6,6 @@ import defaults from './defaults'
import { icons } from './icons'
import theme from './theme'
// Styles
import '@core/scss/template/libs/vuetify/index.scss'
import 'vuetify/styles'
export default createVuetify({
aliases: {
IconBtn: VBtn,

View File

@@ -6639,6 +6639,7 @@ stop-iteration-iterator@^1.0.0:
internal-slot "^1.0.4"
"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"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -6712,6 +6713,7 @@ stringify-object@^3.3.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:
name strip-ansi-cjs
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -7510,10 +7512,10 @@ vite-plugin-vue-layouts@^0.11.0:
debug "^4.3.4"
fast-glob "^3.3.2"
vite-plugin-vuetify@2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/vite-plugin-vuetify/-/vite-plugin-vuetify-2.0.3.tgz#b65ee4e05cfc6bf2b478a32b6d58b42398519f1e"
integrity sha512-HbYajgGgb/noaVKNRhnnXIiQZrNXfNIeanUGAwXgOxL6h/KULS40Uf51Kyz8hNmdegF+DwjgXXI/8J1PNS83xw==
vite-plugin-vuetify@2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/vite-plugin-vuetify/-/vite-plugin-vuetify-2.0.4.tgz#9beb700ee50da58d83399721d6cf4b0af83202d5"
integrity sha512-A4cliYUoP/u4AWSRVRvAPKgpgR987Pss7LpFa7s1GvOe8WjgDq92Rt3eVXrvgxGCWvZsPKziVqfHHdCMqeDhfw==
dependencies:
"@vuetify/loader-shared" "^2.0.3"
debug "^4.3.3"
@@ -7628,10 +7630,10 @@ vuetify-use-dialog@^0.6.11:
dependencies:
defu "^6.1.4"
vuetify@3.6.8:
version "3.6.8"
resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-3.6.8.tgz#89ab0b68aa5488c7b54a04fa4a02a1b802892aaa"
integrity sha512-j0v0iTeSVRj2ZEM9Q8HxejHxmxrQLYQSalhH82hfcraORaiDoqf1XV05N3P5ERXkKiJjJc/LfxFAUUvYSldxeg==
vuetify@3.7.3:
version "3.7.3"
resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-3.7.3.tgz#0e89f7f0298d452510bcbc01b0e9b53a5ce6e883"
integrity sha512-bpuvBpZl1/+nLlXDgdVXekvMNR6W/ciaoa8CYlpeAzAARbY8zUFSoBq05JlLhkIHI58AnzKVy4c09d0OtfYAPg==
vuetify@^3.4.0:
version "3.7.6"