@@ -4,6 +4,7 @@ import { NInput, NPopconfirm, NScrollbar } from 'naive-ui'
44import { SvgIcon } from ' @/components/common'
55import { useAppStore , useChatStore } from ' @/store'
66import { useBasicLayout } from ' @/hooks/useBasicLayout'
7+ import { debounce } from ' @/utils/functions/debounce'
78
89const { isMobile } = useBasicLayout ()
910
@@ -36,6 +37,8 @@ function handleDelete(index: number, event?: MouseEvent | TouchEvent) {
3637 appStore .setSiderCollapsed (true )
3738}
3839
40+ const handleDeleteDebounce = debounce (handleDelete , 600 )
41+
3942function handleEnter({ uuid }: Chat .History , isEdit : boolean , event : KeyboardEvent ) {
4043 event ?.stopPropagation ()
4144 if (event .key === ' Enter' )
@@ -69,8 +72,7 @@ function isActive(uuid: number) {
6972 <div class =" relative flex-1 overflow-hidden break-all text-ellipsis whitespace-nowrap" >
7073 <NInput
7174 v-if =" item.isEdit"
72- v-model:value =" item.title"
73- size =" tiny"
75+ v-model:value =" item.title" size =" tiny"
7476 @keypress =" handleEnter(item, false, $event)"
7577 />
7678 <span v-else >{{ item.title }}</span >
@@ -85,7 +87,7 @@ function isActive(uuid: number) {
8587 <button class =" p-1" >
8688 <SvgIcon icon =" ri:edit-line" @click =" handleEdit(item, true, $event)" />
8789 </button >
88- <NPopconfirm placement =" bottom" @positive-click =" handleDelete (index, $event)" >
90+ <NPopconfirm placement =" bottom" @positive-click =" handleDeleteDebounce (index, $event)" >
8991 <template #trigger >
9092 <button class =" p-1" >
9193 <SvgIcon icon =" ri:delete-bin-line" />
0 commit comments