修改picker数组为对象时的数据显示问题关键:renge-key=title

master
chen 2022-03-29 09:21:25 +08:00
parent 59b86dce48
commit 93429f8edb
2 changed files with 10 additions and 7 deletions

View File

@ -9,7 +9,7 @@
<script> <script>
export default { export default {
name:"container-subgroup", name:"container-subgroup-two",
props:{ props:{
ifLoading:{ ifLoading:{
type:Boolean, type:Boolean,

View File

@ -11,11 +11,11 @@
</image> </image>
</view> </view>
<view class="screen bbot mar-sx20"> <view class="screen bbot mar-sx20">
<picker @change="bindPickerChange" :value="index" :range="array" :range-key="array"> <picker @change="bindPickerChange" :value="index" :range="array" :range-key="'title'">
<view class="li"> <view class="li">
<view class="text">产品类型</view> <view v-if="initial_value!=''" class="text">{{initial_value}}</view>
<image class="img" src="../../static/iocn/xla.png" mode="aspectFill" lazy-load> <view v-else class="text">{{array[index].title}}</view>
</image> <image class="img" src="../../static/iocn/xla.png" mode="aspectFill" lazy-load></image>
</view> </view>
</picker> </picker>
<picker mode="date" :value="date" @change="bindDateChange"> <picker mode="date" :value="date" @change="bindDateChange">
@ -86,13 +86,14 @@
statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 40, statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 40,
inputData: "", inputData: "",
date: currentDate, date: currentDate,
initial_value:'产品类型',
array: [{ array: [{
title: "质保中", title: "质保中",
key: 1, key: 0,
}, { }, {
title: "质保到期", title: "质保到期",
key: 0, key: 1
}, ], }, ],
index: 0, index: 0,
@ -239,6 +240,8 @@
}, },
bindPickerChange(data) { bindPickerChange(data) {
console.log(data) console.log(data)
this.initial_value = '';
this.index = data.detail.value;
}, },
bindDateChange(date) { bindDateChange(date) {
console.log(date) console.log(date)