isShowSelect: false,
dataList: [
{key: -1, value: "POST"},
{key: 0, value: "GET"},
{key: 1, value: "DELETE"},
{key: 2, value: "PUT"}
],
unitName:'请选择',
这些是写在data里的
<view class="right-date" style="width: 100px;font-size: 20upx;"@click="arrowDown" >
<uni-icon type="arrowdown" size="20"></uni-icon>
<p style="font-size: 20upx;" title="请选择">{{unitName}}</p>
</view>
<view class="selectBox_list" v-show="isShowSelect">
<view class="selectBox_listLi" v-for="(item, index) in dataList" :key="index" @click.stop="select(item, index)">{{item.value}}
</view>
</view>
css样式,你们自己写吧,给selectBox_list绝对定位就可以了
arrowDown() {
this.isShowSelect = !this.isShowSelect;
},
select(item, index) {
this.isShowSelect = false;
this.unitName = item.value;
},
这些是写在methods里的