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

View File

@@ -108,8 +108,9 @@ async function deleteItem(item: FileItem) {
}
// 切换路径
function changePath(path: string) {
console.log('List changePath', path)
function changePath(_path: string) {
path.value = _path
console.log('List changePath', path.value)
emit('pathchanged', path)
}

View File

@@ -51,8 +51,9 @@ function changeStorage(code: string) {
}
// 路径变化
function changePath(path: string) {
console.log('Toolbar changePath', path)
function changePath(_path: string) {
path.value = _path
console.log('Toolbar changePath', path.value)
emit('pathchanged', path)
}

View File

@@ -15,6 +15,9 @@ const props = defineProps({
// 对外事件
const emit = defineEmits(['pathchanged', 'loading', 'refreshed'])
// 当前路径
const path = ref(props.path)
// 变量
const open = ref<string[]>([])
// 活跃的文件夹
@@ -99,17 +102,19 @@ watch(() => props.storage, () => {
})
// 监听路径变化
watch(() => props.path, () => {
if (props.path) {
active.value = [props.path]
if (!open.value.includes(props.path))
open.value.push(props.path)
}
})
watch(
path,
() => {
if (props.path) {
active.value = [props.path]
if (!open.value.includes(props.path))
open.value.push(props.path)
}
})
// 监听 refreshPending
watch(
() => refreshPending.value,
refreshPending,
async () => {
if (refreshPending.value && props.path) {
const item = findItem(props.path)