Skip to content

Commit d5e973f

Browse files
committed
Fix dynamic options broken order
1 parent 076f17d commit d5e973f

File tree

5 files changed

+183
-170
lines changed

5 files changed

+183
-170
lines changed

demo/Demo.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
<div class="demo__unit">
9393
<p class="demo__lbl">Default select preset (val2)</p>
94-
<select class="demo__picker" v-model="selVal2" disabled>
94+
<select class="demo__picker" v-model="selVal2">
9595
<option value="">Empty</option>
9696
<option value="" disabled>Empty disabled</option>
9797
<option value="val-1">Value 1</option>
@@ -111,7 +111,7 @@
111111
<div class="demo__units">
112112
<div class="demo__unit">
113113
<p class="demo__lbl">VuePicker (val1)</p>
114-
<VuePicker class="demo__picker" v-model="selVal1" autofocus>
114+
<VuePicker class="demo__picker" v-model="selVal1" :isAutofocus="true">
115115
<VuePickerOption value="">Empty</VuePickerOption>
116116
<VuePickerOption value="" :isDisabled="true"
117117
>Empty disabled</VuePickerOption
@@ -284,9 +284,10 @@
284284
<VuePicker class="demo__picker" v-model="dynVal1">
285285
<VuePickerOption value="">Empty</VuePickerOption>
286286
<VuePickerOption
287-
v-for="opt of dynOpts1"
287+
v-for="(opt, idx) in dynOpts1"
288288
:key="opt.value"
289289
:value="opt.value"
290+
:data-idx="idx"
290291
>
291292
{{ opt.text }}
292293
</VuePickerOption>
@@ -307,14 +308,14 @@ import { ref } from 'vue'
307308
export default {
308309
setup () {
309310
const _randOptions = () => {
310-
const len = _randInt(0, 100)
311-
const suf = String(_randInt(0, 100))
311+
const len = _randInt(3, 5)
312+
const suf = String(_randInt(3, 5))
312313
313314
const options = []
314315
for (let idx = 0; idx < len; idx++) {
315316
options.push({ value: `val-${suf}-${idx}`, text: `Value-${suf} #${idx}` })
316317
}
317-
console.log(options)
318+
console.log('Generated options:', options)
318319
return options
319320
}
320321

0 commit comments

Comments
 (0)