tui-keyboard-input.vue
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<template>
<view class="tui-keyboard-input tui-pwd-box" :style="{backgroundColor:backgroundColor}">
<view class="tui-inner-box">
<view class="tui-input" :class="[inputvalue.length===4?'tui-margin-right':'']" :style="{fontSize:size+'rpx',color:color,width:(inputvalue.length===4?90:70)+'rpx' }"
v-for="(item,index) in inputvalue" :key="index">{{item}}</view>
</view>
</view>
</template>
<script>
export default {
name: "tuiKeyboardInput",
props: {
//背景颜色
backgroundColor: {
type: String,
default: "#fff"
},
size: {
type: Number,
default: 32
},
color: {
type: String,
default: "#333"
},
//输入框的值:数组格式,长度即为输入框个数
inputvalue: {
type: Array,
default: ["", "", "", "", "", ""] //密码圆点 ●
}
},
data() {
return {
};
}
}
</script>
<style scoped>
.tui-pwd-box {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
vertical-align: top;
}
.tui-inner-box {
display: flex;
align-items: center;
justify-content: center;
}
.tui-input {
height: 80rpx;
position: relative;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
border-bottom: 2px solid #666;
}
.tui-margin-right {
margin-right: 30rpx;
}
.tui-input:last-child {
margin-right: 0 !important;
}
</style>