web-africa-h5/components/pop-input.vue

123 lines
2.7 KiB
Vue

<template>
<view v-if="isShow">
<view class="pop-bg" @click="closeFunc(null)"></view>
<view class="pop-input d-c d-c-c">
<view class="ww100 flex-1 pop-top">
<text class="icon iconfont icon-guanbi" @click="closeFunc(null)"></text>
<view class="pop-title">{{ title || '' }}</view>
<view class="input-box d-c-c">
<input v-if="type == 'number'" :placeholder="placeholder || ''" class="input-pop" :password="password" type="number" v-model="values" />
<input v-else-if="type == 'digit'" :placeholder="placeholder || ''" class="input-pop" :password="password" type="digit" v-model="values" />
<input v-else-if="type == 'idcard'" :placeholder="placeholder || ''" class="input-pop" :password="password" type="idcard" v-model="values" />
<input v-else class="input-pop" :placeholder="placeholder || ''" :password="password" type="text" v-model="values" />
</view>
</view>
<view class="border-t ww100 d-b-c" style="height: 89rpx;">
<view class="border-r-e d-c-c flex-1 f28 gray3 hh100" @click="closeFunc(null)">{{$t('MN_F_31')}}</view>
<view class=" d-c-c flex-1 f28 domation hh100" @click="closeFunc(true)">{{$t('MN_F_32')}}</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
values: ''
};
},
props: ['isShow', 'title', 'type', 'password','placeholder'],
watch:{
isShow:function(n,o){
if(n!=o){
this.values = '';
}
}
},
methods: {
closeFunc(e) {
if (e) {
if(this.values == ''){
uni.showToast({
title:this.placeholder,
icon:'none'
})
return
}
this.$emit('close', this.values);
} else {
this.$emit('close', null);
}
}
}
};
</script>
<style lang="scss">
.pop-bg {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
margin: auto;
z-index: 98;
background-color: rgba(0, 0, 0, 0.65);
}
.icon.icon-guanbi {
font-size: 32rpx;
color: #999;
position: absolute;
right: 25rpx;
top: 22rpx;
z-index: 101;
}
.pop-input {
width: 665rpx;
height: 290rpx;
background: #ffffff;
border-radius: 25rpx;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
z-index: 100;
}
.pop-top {
padding: 40rpx 60rpx 0 60rpx;
box-sizing: border-box;
}
.pop-title {
font-size: 30rpx;
color: #333;
font-weight: bold;
margin-bottom: 22rpx;
}
.input-box {
width: 542rpx;
height: 64rpx;
background: #ffffff;
border: 1rpx solid #dddddd;
border-radius: 32rpx;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto;
}
.input-pop {
box-sizing: border-box;
border-radius: 32rpx;
line-height: 1.5;
font-size: 28rpx;
color: #333;
padding: 0 25rpx;
border: none;
flex: 1;
outline-offset: 0;
}
</style>