调整图片选择器

This commit is contained in:
Jason 2022-10-13 15:01:12 +08:00
parent 0e7944bd37
commit 3094503b17
1 changed files with 16 additions and 11 deletions

View File

@ -83,6 +83,7 @@ import FileItem from './file.vue'
import Material from './index.vue' import Material from './index.vue'
import Preview from './preview.vue' import Preview from './preview.vue'
import useAppStore from '@/stores/modules/app' import useAppStore from '@/stores/modules/app'
import { useThrottleFn } from '@vueuse/shared'
export default defineComponent({ export default defineComponent({
components: { components: {
Popup, Popup,
@ -170,17 +171,21 @@ export default defineComponent({
if (limit.value == -1) return null if (limit.value == -1) return null
return limit.value - fileList.value.length return limit.value - fileList.value.length
}) })
const handleConfirm = () => { const handleConfirm = useThrottleFn(
const selectUri = select.value.map((item) => () => {
props.excludeDomain ? item.path : item.uri const selectUri = select.value.map((item) =>
) props.excludeDomain ? item.path : item.uri
if (!isAdd.value) { )
fileList.value.splice(currentIndex.value, 1, selectUri.shift()) if (!isAdd.value) {
} else { fileList.value.splice(currentIndex.value, 1, selectUri.shift())
fileList.value = [...fileList.value, ...selectUri] } else {
} fileList.value = [...fileList.value, ...selectUri]
handleChange() }
} handleChange()
},
1000,
false
)
const showPopup = (index: number) => { const showPopup = (index: number) => {
if (disabled.value) return if (disabled.value) return
if (index >= 0) { if (index >= 0) {