Commit 02a38e38 authored by Damon's avatar Damon

下拉组件默认值

parent 1d3760d6
......@@ -8,7 +8,7 @@
<view class="u-flex u-row-between picker-common">
<picker mode="selector" :value="index" range-key="label" :range="settings" @click="show = true" @change="pickerChange" class="u-flex-1">
<view class="txt">{{text}}</view>
<view class="txt">{{text || '请选择'}}</view>
</picker>
<u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
......@@ -33,7 +33,8 @@
},
data() {
return {
show: false
show: false,
index: ''
}
},
computed: {
......@@ -89,8 +90,8 @@
this.valueChange(id)
},
pickerChange(data) {
const index = data.detail.value
const id = this.item.fieldsOptions[index].key
this.index = data.detail.value
const id = this.item.fieldsOptions[this.index].key
this.dataValue = id
this.valueChange(id)
},
......
......@@ -8,7 +8,7 @@
<u-picker v-model="showPicker" range-key="label" @columnchange="columnchange" :mode="isNotMulti?'selector':'multiSelector'" @confirm="pickerConfirm" :range="settings"></u-picker> -->
<view class="u-flex u-row-between picker-common">
<picker :mode="isNotMulti?'selector':'multiSelector'" :value="index" range-key="label" :range="settings" @click="showPicker = true" @change="pickerChange" class="txt u-flex-1">
<view>{{text}}</view>
<view>{{text || '请选择'}}</view>
</picker>
<u-icon class="input-icon" color="#2272FF" :name="showPicker ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment