File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 11import { NDynamicInput } from 'naive-ui'
22
33export 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 } ,
Original file line number Diff line number Diff 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 >
You can’t perform that action at this time.
0 commit comments