fix(pagePlugin): 删除文件夹添加节流,避免多次出现无法删除弹窗 (#74)

* fix(pagePlugin): 删除文件夹添加防抖,避免多次出现无法删除弹窗

* fix(pagePlugin): use throttle by review comment
This commit is contained in:
chilingling 2023-11-16 01:55:48 -08:00 committed by GitHub
parent 9be6f31129
commit 9911abe6de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 27 deletions

View File

@ -32,6 +32,7 @@ import { Button, Collapse, CollapseItem } from '@opentiny/vue'
import { PluginSetting, SvgButton, ButtonGroup } from '@opentiny/tiny-engine-common'
import { usePage, useModal, useApp, useNotify } from '@opentiny/tiny-engine-controller'
import { isEqual } from '@opentiny/vue-renderless/common/object'
import throttle from '@opentiny/vue-renderless/common/deps/throttle'
import PageGeneral from './PageGeneral.vue'
import http from './http.js'
@ -158,40 +159,39 @@ export default {
type: 'error',
message: '此文件夹不是空文件夹,不能删除!'
})
return false
} else {
confirm({
title: '提示',
message: '您是否要删除文件夹?',
exec: () => {
const id = pageSettingState.currentPageData?.id || ''
requestDeletePage(id)
.then(() => {
pageSettingState.updateTreeData()
closeFolderSettingPanel()
useNotify({
type: 'success',
message: '删除文件夹成功!'
})
})
.catch((error) => {
useNotify({
type: 'success',
title: '删除文件夹失败!',
message: JSON.stringify(error?.message || error)
})
})
}
})
return
}
return undefined
confirm({
title: '提示',
message: '您是否要删除文件夹?',
exec: () => {
const id = pageSettingState.currentPageData?.id || ''
requestDeletePage(id)
.then(() => {
pageSettingState.updateTreeData()
closeFolderSettingPanel()
useNotify({
type: 'success',
message: '删除文件夹成功!'
})
})
.catch((error) => {
useNotify({
type: 'success',
title: '删除文件夹失败!',
message: JSON.stringify(error?.message || error)
})
})
}
})
}
return {
saveFolderSetting,
deleteFolder,
deleteFolder: throttle(5000, true, deleteFolder),
folderGeneralRef,
closeFolderSettingPanel,
isShow,