tui-keyboard-input.vue 1.4 KB

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