feat: 新增选择文件上传功能,优化部分代码实现

This commit is contained in:
539943419 committed 2024-08-16 00:39:35 +08:00
1 parent 60477a9112
commit fda693326e
11 files changed
+292 -71

No files matched your search

+5 -5
View File
@@ -35,12 +35,12 @@ const onClickoutside = async () => {
}
const handleMainMouseLeave = async () => {
// setTimeout(() => {
// showContextMenu.value -= 1
// }, 200)
nextTick(()=>{
setTimeout(() => {
showContextMenu.value -= 1
})
}, 100)
// nextTick(()=>{
// showContextMenu.value -= 1
// })
}
const handleSelect = async (key: string) => {
@@ -40,6 +40,9 @@ import {
} from '@vicons/ionicons5'
import { computed, ref } from 'vue'
import dateFormatter from '@/hooks/dateFormatter'
import useMiaoFetchApi from '@/hooks/useMiaoFetchApi'
const miaoFetchApi = useMiaoFetchApi()
const props = defineProps<{
item: VirtualDirectory | VirtualFile
@@ -50,6 +53,7 @@ const props = defineProps<{
const emit = defineEmits<{
download: []
delete: []
rename: []
dragStart: [event: DragEvent, item: VirtualDirectory | VirtualFile]
}>()
@@ -66,10 +70,14 @@ const time = computed(() => {
const dropDownOptions = computed(() => {
const options = [
{
label: '重命名',
key: 'rename'
},
{
label: '删除',
key: 'delete'
}
},
]
if (itemType.value === 'file') {
options.push(
@@ -84,8 +92,11 @@ const dropDownOptions = computed(() => {
return options
})
// 是不是可以直接在这里面实现?
const handleDropdownSelect = (key: string) => {
if (key === 'download') {
if (key === 'rename') {
emit('rename')
} else if (key === 'download') {
emit('download')
} else if (key === 'delete') {
emit('delete')
+2
View File
@@ -24,6 +24,7 @@ const _resolve = ref()
type popupConfigType = {
title: string
content?: string
inputValue?: string,
inputProps?: InputProps
options: {
label: string
@@ -36,6 +37,7 @@ const popupConfig = ref<popupConfigType>()
const popup = async (config: popupConfigType) => {
popupConfig.value = config
inputValue.value = config.inputValue ?? ''
showMask.value = true
const key = await new Promise((resolve: (key: unknown) => unknown) => {
_resolve.value = resolve