allMoreSelectInput.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <style lang="scss" scoped>
  2. .change-input-box{
  3. display: flex;
  4. align-items: center;
  5. .change-input {
  6. position: relative;
  7. width: 212upx;
  8. height: 80upx;
  9. line-height: 80upx;
  10. border: 1upx solid #dddddd;
  11. border-radius: 4upx;
  12. text-align: center;
  13. margin-right: 24upx;
  14. font-size: 40upx;
  15. input{
  16. position: absolute;
  17. width: 100%;
  18. height: 100%;
  19. opacity:1;
  20. &.active{
  21. opacity:0;
  22. }
  23. }
  24. text{
  25. &.active{
  26. background: rgba(10,150,210,0.6);
  27. }
  28. }
  29. }
  30. .unit{
  31. width: 50upx;
  32. text-align: center;
  33. }
  34. }
  35. </style>
  36. <template>
  37. <view class="change-input-box">
  38. <view class="change-input">
  39. <input :focus="isFocus" :style="isActive?'caret-color:rgba(0,0,0,0)':'caret-color:rgba(0,0,0,1)'" type="number" @focus="initAllInput" @blur="moveAllInput" v-model="inputVal" @input="changeAllInput" >
  40. <text :class="isActive?'active':''">{{value?value:''}}</text>
  41. </view>
  42. <view class="unit">扎</view>
  43. <view class="change-input">
  44. <input :focus="isFocusOne" :style="isActiveOne?'caret-color:rgba(0,0,0,0)':'caret-color:rgba(0,0,0,1)'" type="number" @focus="initAllInputOne" @blur="moveAllInputOne" v-model="inputValOne" @input="changeAllInputOne" >
  45. <text :class="isActiveOne?'active':''">{{valueOne?valueOne:''}}</text>
  46. </view>
  47. <view class="unit">支</view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. name: "allSelectInput",
  53. props: {
  54. isActive: '',
  55. isFocus: '',
  56. value: '',
  57. isActiveOne: '',
  58. isFocusOne: '',
  59. valueOne: '',
  60. },
  61. data() {
  62. return {
  63. inputVal:'',
  64. inputValOne:'',
  65. };
  66. },
  67. onLoad(e){
  68. this.title = e.title
  69. },
  70. methods: {
  71. initAllInput() {
  72. this.$emit('initAllInput')
  73. },
  74. moveAllInput(){
  75. let inputVal = this.inputVal
  76. this.inputVal = '';
  77. this.$emit('moveAllInput',inputVal)
  78. },
  79. changeAllInput(e){
  80. if(e.detail.keyCode==8){
  81. this.$emit('deleteInputVal')
  82. return;
  83. }
  84. this.$emit('deleteInputVal')
  85. },
  86. initAllInputOne() {
  87. this.$emit('initAllInputOne')
  88. },
  89. moveAllInputOne(){
  90. let inputVal = this.inputValOne
  91. this.inputValOne = '';
  92. this.$emit('moveAllInputOne',inputVal)
  93. },
  94. changeAllInputOne(e){
  95. if(e.detail.keyCode==8){
  96. this.$emit('deleteInputValOne')
  97. return;
  98. }
  99. this.$emit('deleteInputValOne')
  100. }
  101. }
  102. };
  103. </script>