页面有两种状态,一种是可编辑状态,一种是不可编辑状态。只有当页面处于可编辑状态时,点击picker组件才会弹出。
一:为picker组件添加disabled属性,并且绑定变量一个变量
<picker @change="singleClick($event,1)" :range="checkList" style="width: 100%;" :disabled="pickerDisable">
<view class="flex-center1">
<text>是否需要泊车</text>
<view>
<text v-if="customerInfo.car === ''">暂无</text>
<text class="valueText" v-else>{{checkList[customerInfo.car]}}</text>
<u-icon name="arrow-right" color="#333333" size="28"></u-icon>
</view>
</view>
</picker>
二:通过改变变量的值来实现picker组件的展开与收起
edit()
{
this.pickerDisable = false;
this.$refs.uToast.show({
title: '可以进行编辑啦~',
type: 'warning',
icon: false
})
}