diff --git a/src/components/FileBrowser.vue b/src/components/FileBrowser.vue index eec6b6a5..4a56b261 100644 --- a/src/components/FileBrowser.vue +++ b/src/components/FileBrowser.vue @@ -5,6 +5,8 @@ import FileNavigator from './filebrowser/FileNavigator.vue' import type { EndPoints, FileItem, StorageConf } from '@/api/types' import { storageIconDict } from '@/api/constants' import type { AxiosInstance } from 'axios' +import { useDynamicButton } from '@/composables/useDynamicButton' +import { usePWA } from '@/composables/usePWA' // LocalStorage keys const SORT_KEY = 'fileBrowser.sort' @@ -33,6 +35,9 @@ const props = defineProps({ // 对外事件 const emit = defineEmits(['pathchanged']) +const route = useRoute() +const { appMode } = usePWA() +const toolbarRef = ref | null>(null) const fileIcons = { // 压缩包 @@ -123,6 +128,18 @@ const fileIcons = { other: 'mdi-file-outline', } +function openNewFolderDialog() { + toolbarRef.value?.openNewFolderDialog() +} + +const showFloatingNewFolderAction = computed(() => route.path === '/filemanager') + +useDynamicButton({ + icon: 'mdi-folder-plus-outline', + onClick: openNewFolderDialog, + show: computed(() => appMode.value && showFloatingNewFolderAction.value), +}) + // 加载次数 const loading = ref(0) @@ -254,12 +271,14 @@ function stopDrag() {
+ + + +