修改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>
export default {
name:"container-subgroup",
name:"container-subgroup-two",
props:{
ifLoading:{
type:Boolean,

View File

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