Skip to content

Commit 603ae86

Browse files
chore: restore valueModel initialization in VDropDown
1 parent cc0b9fa commit 603ae86

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/components/pivottable-ui/VDropdown.vue

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
class="pvtDropdown"
55
>
66
<option
7-
v-for="(text, key) in options"
8-
:key="key"
7+
v-for="(text, index) in options"
8+
:key="index"
99
:value="text"
1010
>
1111
{{ text }}
@@ -22,23 +22,14 @@ const emit = defineEmits<{
2222
2323
interface DropdownProps {
2424
options: string[]
25-
value: string
25+
value?: string
2626
}
2727
2828
const props = withDefaults(defineProps<DropdownProps>(), {
29-
options: () => [],
3029
value: ''
3130
})
3231
33-
const valueModel = ref<string>('')
34-
35-
watch(
36-
[() => props.value, () => props.options],
37-
([val, opts]: [string, string[]]) => {
38-
valueModel.value = val || opts[0] || ''
39-
},
40-
{ immediate: true }
41-
)
32+
const valueModel = ref<string>(props.value || props.options[0] || '')
4233
4334
watch(
4435
valueModel,

0 commit comments

Comments
 (0)