Commit 02a38e38 authored by Damon's avatar Damon

下拉组件默认值

parent 1d3760d6
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<view class="u-flex u-row-between picker-common"> <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"> <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> </picker>
<u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon> <u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view> </view>
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
}, },
data() { data() {
return { return {
show: false show: false,
index: ''
} }
}, },
computed: { computed: {
...@@ -89,8 +90,8 @@ ...@@ -89,8 +90,8 @@
this.valueChange(id) this.valueChange(id)
}, },
pickerChange(data) { pickerChange(data) {
const index = data.detail.value this.index = data.detail.value
const id = this.item.fieldsOptions[index].key const id = this.item.fieldsOptions[this.index].key
this.dataValue = id this.dataValue = id
this.valueChange(id) this.valueChange(id)
}, },
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<u-picker v-model="showPicker" range-key="label" @columnchange="columnchange" :mode="isNotMulti?'selector':'multiSelector'" @confirm="pickerConfirm" :range="settings"></u-picker> --> <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"> <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"> <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> </picker>
<u-icon class="input-icon" color="#2272FF" :name="showPicker ? 'arrow-up' : 'arrow-down'"></u-icon> <u-icon class="input-icon" color="#2272FF" :name="showPicker ? 'arrow-up' : 'arrow-down'"></u-icon>
</view> </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