Skip to content

Commit 9570ed6

Browse files
committed
fix: 修复名单重命名后消失问题、编辑无效的问题
1 parent 6b12565 commit 9570ed6

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

components/dynamic-input.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { NDynamicInput } from 'naive-ui'
22

33
export default defineComponent({
4-
setup(_, { attrs, slots }) {
4+
inheritAttrs: false,
5+
setup(_, { attrs, emit, slots }) {
56
const propsValue = toRef(attrs, 'value') as Ref<unknown[] | undefined>
67
const displayValue: Ref<unknown[]> = ref([])
78

@@ -14,13 +15,20 @@ export default defineComponent({
1415
await nextFrame()
1516
}
1617
}
18+
if (origin.length < legacy.length) // 选项变少
19+
displayValue.value.splice(origin.length)
1720
}, { immediate: true, deep: true })
1821

22+
const handleEdit = () => {
23+
emit('update:value', displayValue.value)
24+
}
25+
1926
return () => (
2027
<NDynamicInput
2128
{...attrs}
2229
v-model:value={displayValue.value}
2330
v-slots={slots}
31+
onUpdate:value={handleEdit}
2432
/>
2533
)
2634
},

components/settings/group/name.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ function handleRename() {
4040
:maxlength="MAX_GROUP_NAME_LENGTH"
4141
/>
4242
<template #trigger>
43-
<NButton
44-
class="operator ml-1"
45-
size="tiny"
46-
text
47-
@click.stop="$emit('rename', renameTo)"
48-
>
43+
<NButton class="operator ml-1" size="tiny" text>
4944
<NaiveIcon name="ep:edit" :size="14" />
5045
</NButton>
5146
</template>

0 commit comments

Comments
 (0)