<template>
|
<uni-popup ref="sex" background-color="#fff">
|
<view class="sex">
|
<view class="title">
|
<text>性别</text>
|
<view class="title_icon" @click="closeSex">
|
<uni-icons color="#CCCCCB" type="closeempty" size="20"></uni-icons>
|
</view>
|
</view>
|
<view class="content">
|
<picker-view
|
:value="sex"
|
:indicator-style="indicatorStyle"
|
@change="bindChange"
|
:immediate-change="true"
|
class="picker-view">
|
<picker-view-column>
|
<view class="item" v-for="(item,index) in list" :key="index">{{item.label}}</view>
|
</picker-view-column>
|
</picker-view>
|
</view>
|
<view class="submit" @click="updataSex">确定</view>
|
</view>
|
</uni-popup>
|
</template>
|
|
<script>
|
export default {
|
name:"sexSelect",
|
data() {
|
return {
|
indicatorStyle: 'height: 40px;',
|
list: [
|
{
|
label: '男',
|
value: '1'
|
},
|
{
|
label: '女',
|
value: '2'
|
}
|
],
|
sex: [0]
|
};
|
},
|
methods: {
|
open(sex) {
|
let index = this.list.findIndex(item=>item.value==sex)
|
this.sex = [index>0?index:0]
|
this.$refs.sex.open('bottom')
|
},
|
bindChange(v) {
|
// console.log(v.detail.value);
|
this.sex = v.detail.value
|
},
|
closeSex() {
|
this.$refs.sex.close()
|
},
|
updataSex() {
|
// console.log(this.sex);
|
// console.log(this.list[this.sex[0]]);
|
// debugger
|
this.$emit('updata', this.list[this.sex[0]].value)
|
this.$refs.sex.close()
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.sex {
|
padding: 44rpx 32rpx;
|
background-color: #FFFFFF;
|
box-sizing: border-box;
|
.title {
|
width: 100%;
|
text-align: center;
|
position: relative;
|
text {
|
font-size: 32rpx;
|
font-family: PingFang SC-Semibold, PingFang SC;
|
font-weight: 600;
|
color: #333333;
|
}
|
.title_icon {
|
position: absolute;
|
right: 0;
|
top: 0;
|
}
|
}
|
.content {
|
width: 100%;
|
margin-top: 80rpx;
|
.picker-view {
|
width: 100%;
|
height: 200rpx;
|
.item {
|
height: 40px;
|
line-height: 40px;
|
text-align: center;
|
}
|
}
|
}
|
.submit {
|
width: 100%;
|
height: 72rpx;
|
line-height: 72rpx;
|
text-align: center;
|
background: linear-gradient(270deg, #D20A0A 0%, #D95A5A 100%);
|
border-radius: 36rpx;
|
font-size: 32rpx;
|
font-family: PingFang SC-Medium, PingFang SC;
|
font-weight: 500;
|
color: #FFFFFF;
|
margin-top: 50rpx;
|
}
|
}
|
</style>
|