This commit is contained in:
jxxghp
2023-08-26 12:52:46 +08:00
parent 476bd4bd19
commit f4aef8f9dd
3 changed files with 19 additions and 12 deletions
+3 -2
View File
@@ -108,8 +108,9 @@ async function deleteItem(item: FileItem) {
} }
// 切换路径 // 切换路径
function changePath(path: string) { function changePath(_path: string) {
console.log('List changePath', path) path.value = _path
console.log('List changePath', path.value)
emit('pathchanged', path) emit('pathchanged', path)
} }
+3 -2
View File
@@ -51,8 +51,9 @@ function changeStorage(code: string) {
} }
// 路径变化 // 路径变化
function changePath(path: string) { function changePath(_path: string) {
console.log('Toolbar changePath', path) path.value = _path
console.log('Toolbar changePath', path.value)
emit('pathchanged', path) emit('pathchanged', path)
} }
+13 -8
View File
@@ -15,6 +15,9 @@ const props = defineProps({
// 对外事件 // 对外事件
const emit = defineEmits(['pathchanged', 'loading', 'refreshed']) const emit = defineEmits(['pathchanged', 'loading', 'refreshed'])
// 当前路径
const path = ref(props.path)
// 变量 // 变量
const open = ref<string[]>([]) const open = ref<string[]>([])
// 活跃的文件夹 // 活跃的文件夹
@@ -99,17 +102,19 @@ watch(() => props.storage, () => {
}) })
// 监听路径变化 // 监听路径变化
watch(() => props.path, () => { watch(
if (props.path) { path,
active.value = [props.path] () => {
if (!open.value.includes(props.path)) if (props.path) {
open.value.push(props.path) active.value = [props.path]
} if (!open.value.includes(props.path))
}) open.value.push(props.path)
}
})
// 监听 refreshPending // 监听 refreshPending
watch( watch(
() => refreshPending.value, refreshPending,
async () => { async () => {
if (refreshPending.value && props.path) { if (refreshPending.value && props.path) {
const item = findItem(props.path) const item = findItem(props.path)