keyboard.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div class="keyboard">
  3. <bottom-popup class="popup-wrap" :show="show" maskBgcolor="none" @close="comfirm" :mask="false">
  4. <div class="ui-keyboard">
  5. <ul class="ui-keyboard-numbers">
  6. <li :class="{'zero': item == 0}" v-for="(item, index) in keyLeftData" :key="index" @click="clickKeyFn(item)">{{ item }}</li>
  7. </ul>
  8. <ul class="ui-keyboard-btn">
  9. <li class="btn-del" @click="del">
  10. <i class="iconfont iconshanchu"></i>
  11. </li>
  12. <li class="btn-ok" @click="comfirm">搜索</li>
  13. </ul>
  14. </div>
  15. </bottom-popup>
  16. </div>
  17. </template>
  18. <script>
  19. import BottomPopup from '@/components/plugin/bottom-popup'
  20. export default {
  21. name: 'keyboard',
  22. components: {
  23. BottomPopup
  24. },
  25. props: {
  26. show: {
  27. type: Boolean,
  28. default: false
  29. }
  30. },
  31. data() {
  32. return {
  33. keyLeftData: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.']
  34. }
  35. },
  36. methods: {
  37. close() {
  38. this.$emit('comfirm')
  39. },
  40. // 点击数字键盘
  41. clickKeyFn(val) {
  42. this.$emit('clickKey', val)
  43. },
  44. // 确认
  45. comfirm() {
  46. this.$emit('comfirm')
  47. },
  48. // 删除
  49. del() {
  50. this.$emit('del')
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .popup-wrap {
  57. .ui-keyboard {
  58. @include disFlex(center, center);
  59. padding: 0 20upx 20upx 20upx;
  60. background-color: $backColor;
  61. box-shadow: 0 -8upx 16upx #ddd;
  62. // 左侧键盘
  63. .ui-keyboard-numbers {
  64. width: 78%;
  65. display: flex;
  66. align-items: center;
  67. flex-wrap: wrap;
  68. li {
  69. width: calc(33.33% - 20upx);
  70. }
  71. li.zero {
  72. width: calc(66.66% - 20upx);
  73. }
  74. }
  75. // 右侧键盘
  76. .ui-keyboard-btn {
  77. width: 22%;
  78. li {
  79. margin-right: 0;
  80. }
  81. li.btn-ok {
  82. height: 310upx;
  83. color: #fff;
  84. background-color: $mainColor;
  85. // line-height: 310upx
  86. }
  87. }
  88. li {
  89. @include disFlex(center, center);
  90. height: 90upx;
  91. // line-height: 90upx;
  92. text-align: center;
  93. border-radius: 10upx;
  94. background-color: #fff;
  95. margin-top: 20upx;
  96. margin-right: 20upx;
  97. font-size: 38upx;
  98. font-weight: bold;
  99. box-shadow: 0 2upx 10upx #ddd;
  100. }
  101. li:active {
  102. background-color: rgba(0, 0, 0, 0.1);
  103. }
  104. }
  105. }
  106. </style>