Skip to content

Commit f63de5b

Browse files
authored
fix: 🐛 修复 drop-menu-item 有选项值为空字符串时导致新值错误并触发组件内部警告的问题
1 parent 6f12aa4 commit f63de5b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/uni_modules/wot-design-uni/components/wd-drop-menu-item/wd-drop-menu-item.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ function choose(index: number) {
128128
if (props.disabled) return
129129
const { valueKey } = props
130130
const item = props.options[index]
131-
emit('update:modelValue', item[valueKey] !== '' && item[valueKey] !== undefined ? item[valueKey] : item)
131+
const newValue = item[valueKey] !== undefined ? item[valueKey] : item
132+
emit('update:modelValue', newValue)
132133
emit('change', {
133-
value: item[valueKey] !== '' && item[valueKey] !== undefined ? item[valueKey] : item,
134+
value: newValue,
134135
selectedItem: item
135136
})
136137
close()

0 commit comments

Comments
 (0)