效果图
<van-popup v-model="show" position="center" :overlay="true" transition="0s easing">
<div class='picker_box'>
<p class='set'>设置店铺折扣率</p>
<div class='num'>
<span class='shi'>{{shi}}</span>
<span>.</span>
<span class='ge'>{{ge}}</span>
<span>折</span>
</div>
<van-picker :columns="columns" :visible-item-count=3 @cancel="onCancel" @confirm="onConfirm" @change="onChange" />
</div>
</van-popup>
//在script里首先定义一个对象数组
const citys = {
'1': ['0','1','2','3','4','5','6','7','8','9'],
'2': ['2'],
'3': ['3'],
'4': ['4'],
'5': ['5'],
'6': ['6'],
'7': ['7'],
'8': ['8'],
'9': ['9'],
};
//data里
columns: [
{
values: Object.keys(citys),
className: 'column1'
},
{
values: citys['1'],
className: 'column2'
}
],
//methods里面 ,显示遮罩层
xian(){
this.show=true;
},