Skip to content

Commit 3b2577a

Browse files
committed
refactor: CSelect: refactor programatic selecting,
Delete option class key (now class can be passed in attrs.class)
1 parent bfa7a79 commit 3b2577a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/components/form/CSelect.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,33 @@
1818
v-bind="$attrs"
1919
:id="safeId"
2020
:class="inputClasses"
21-
:value="state"
2221
@input="onSelect($event)"
2322
>
24-
<option v-if="placeholder" value="" selected disabled hidden>
23+
<option
24+
v-if="placeholder"
25+
value=""
26+
selected
27+
disabled
28+
hidden
29+
>
2530
{{placeholder}}
2631
</option>
2732
<template v-for="(option, key) in options">
2833
<option
2934
v-if="typeof option === 'object'"
3035
:value="option.value"
31-
:class="option.class"
3236
v-bind="option.attrs"
3337
:disabled="option.disabled"
38+
:selected="option.value === value"
3439
:data-key="key"
3540
:key="key"
3641
>
3742
{{option.label || option.value}}
3843
</option>
3944
<option
4045
v-else
41-
:value="String(option)"
46+
:value="option"
47+
:selected="option === value"
4248
:data-key="key"
4349
:key="key"
4450
>
@@ -118,6 +124,9 @@ export default {
118124
// }
119125
// },
120126
computed: {
127+
selectedItem () {
128+
129+
},
121130
// classesComputedProps mixin
122131
// haveCustomSize () {
123132
// return ['sm','lg'].includes(this.size)

0 commit comments

Comments
 (0)