car.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="fs-car" :class="modelValue ? 'show' : ''">
  3. <view class="fs-car-header">
  4. <view class="fs-car-header-btn" @click="handleClose">
  5. 关闭
  6. </view>
  7. </view>
  8. <view class="fs-car-inner">
  9. <view class="swiper-item">
  10. <view class="swiper-item-inner" v-for="(item, index) in keyboardList" :key="index">
  11. <view v-if="item !== '#' && item !== 'del'" @click="handleAction(item)" class="swiper-item-word"
  12. v-text="item"></view>
  13. <view v-if="item == 'del'" class="swiper-item-del" @click="handleAction(item)">
  14. <fs-icon type="icon-backspace" size="50rpx"></fs-icon>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script setup>
  22. import { ref, computed, watch } from 'vue'
  23. const props = defineProps({
  24. modelValue: Boolean,
  25. index: {
  26. type: Number,
  27. default: 0
  28. }
  29. })
  30. const emits = defineEmits(['update:modelValue', 'update:index', 'change', 'close'])
  31. const keyboard1 = ['晋','京','津','冀','蒙','辽','吉','黑','沪','苏','浙','皖','闽','赣','鲁','豫','鄂','湘','粤','桂','琼','渝','川','贵','云','藏','陕','甘','青','宁','新','台','港','澳','#','#','#','#','#','#','del'
  32. ]
  33. const keyboard2 = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S','T', 'U', 'V', 'W', 'X', 'Y', 'Z','#','#','#','#','#','#','#','#','#','#','#','#','#','#','#','del'
  34. ]
  35. const keyboard3 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',1,2,3,4,5,6,7,8,9,0,'使','领','学','#','#','del'
  36. ]
  37. let keyboardList = computed(() => {
  38. if (props.index === 0) {
  39. return keyboard1
  40. } else if (props.index === 1) {
  41. return keyboard2
  42. } else {
  43. return keyboard3
  44. }
  45. })
  46. const handleAction = item => {
  47. emits('change', item)
  48. }
  49. const handleClose = () => {
  50. emits('close')
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. $height: 750rpx;
  55. .fs-car {
  56. position: fixed;
  57. bottom: 0;
  58. left: 0;
  59. right: 0;
  60. z-index: 999;
  61. background-color: #d7d8dc;
  62. height: $height;
  63. transform: translateY(100%);
  64. transition: all .3s;
  65. &-header {
  66. height: 80rpx;
  67. display: flex;
  68. justify-content: flex-end;
  69. align-items: center;
  70. padding-top: 25rpx;
  71. padding-right: 25rpx;
  72. box-sizing: border-box;
  73. &-btn {
  74. background: #fff;
  75. height: 65rpx;
  76. line-height: 65rpx;
  77. padding: 0 15rpx;
  78. border-radius: 8rpx;
  79. }
  80. }
  81. &-inner {
  82. height: calc($height - 80rpx);
  83. width: 100%;
  84. .swiper-item {
  85. height: calc($height - 80rpx);
  86. width: 100%;
  87. display: flex;
  88. justify-content: space-between;
  89. flex-wrap: wrap;
  90. padding: 25rpx;
  91. box-sizing: border-box;
  92. .swiper-item-inner {
  93. width: calc(100% / 6);
  94. display: flex;
  95. justify-content: center;
  96. align-items: center;
  97. height: 75rpx;
  98. margin-bottom: calc(((100% / 6) - 40rpx) / 5);
  99. .swiper-item-word {
  100. width: 100rpx;
  101. height: 75rpx;
  102. border-radius: 8rpx;
  103. background-color: #f0f1f5;
  104. font-size: 33rpx;
  105. line-height: 75rpx;
  106. text-align: center;
  107. color: #222;
  108. font-weight: bold;
  109. transition: all 0.2s;
  110. box-shadow: 1px 0 25px #dfdfdf, 0 1px 0 #cfcfcf, 0 1px 0 #bfbfbf, 0 1px 1px #6f6f6f;
  111. &:active {
  112. opacity: 0.8;
  113. background-color: #ffffff;
  114. transform: translateY(-5rpx);
  115. }
  116. }
  117. .swiper-item-del {
  118. width: 100rpx;
  119. height: 75rpx;
  120. border-radius: 8rpx;
  121. background-color: #f0f1f5;
  122. transition: all 0.2s;
  123. box-shadow: 1px 0 25px #dfdfdf, 0 1px 0 #cfcfcf, 0 1px 0 #bfbfbf, 0 1px 1px #6f6f6f;
  124. display: flex;
  125. justify-content: center;
  126. align-items: center;
  127. &:active {
  128. opacity: 0.8;
  129. background-color: #ffffff;
  130. transform: translateY(-5rpx);
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
  137. .show {
  138. transform: translateY(0);
  139. }
  140. </style>