<van-field clickable name="XXXX" is-link readonly :value="statusValue" placeholder="请选择是否油库" @click="showStatusFn" :rules="[{ required: true, message: '请选择是否油库' }]" /> <van-popup v-model="showStatus" position="bottom" > <van-picker ref="myPicker" show-toolbar value-key="value" :columns="statusColumns" @confirm="statusConfirm" @cancel="showStatus = false" /> </van-popup>
:lazy-render="false"
showStatusFn () { let currentIndex = 0; for (let i = 0; i < this.statusColumns.length; i++) { if (this.form.deptType == this.statusColumns[i].key) { currentIndex = i; } } // setTimeout(() => { console.log(this.$refs.myPicker) this.$refs.myPicker.setColumnIndex(0, currentIndex); this.showStatus = true; // }, 100); },
标签:picker,van,回显,refs,currentIndex,statusColumns From: https://www.cnblogs.com/dianzan/p/16916000.html