allSelectInput.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <style lang="scss" scoped>
  2. .change-input {
  3. position: relative;
  4. width: 164px;
  5. height: 60px;
  6. line-height: 60px;
  7. text-align: center;
  8. background: #ffffff;
  9. border: 1px solid #dddddd;
  10. border-radius: 4px;
  11. font-size: 25px;
  12. input{
  13. position: absolute;
  14. width: 100%;
  15. height: 100%;
  16. //opacity:1;
  17. &.active{
  18. //opacity:0;
  19. }
  20. }
  21. text{
  22. &.active{
  23. background: rgba(10,150,210,0.6);
  24. }
  25. }
  26. }
  27. </style>
  28. <template>
  29. <view class="change-input" :style="'width:'+width+'rpx !important;height:'+height+'rpx !important;font-size:'+fontSize+'rpx !important'" >
  30. <input :focus="isFocus" :style="isActive?'caret-color:rgba(0,0,0,0)':'caret-color:rgba(0,0,0,1)'" :type="inputType?inputType:'number'" @focus="initAllInput" @blur="moveAllInput" v-model="inputVal" @input="changeAllInput" :placeholder="value==''&&inputVal==''?placeholder:''">
  31. <text :class="isActive?'active':''">{{value?value:''}}</text>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. name: "allSelectInput",
  37. props: {
  38. width: '',
  39. height: '',
  40. fontSize: '',
  41. isActive: '',
  42. isFocus: '',
  43. value: '',
  44. placeholder: '',
  45. inputType:'',
  46. },
  47. data() {
  48. return {
  49. inputVal:'',
  50. };
  51. },
  52. onLoad(e){
  53. this.title = e.title
  54. },
  55. methods: {
  56. initAllInput() {
  57. this.$emit('initAllInput')
  58. },
  59. moveAllInput(){
  60. let inputVal = this.inputVal
  61. this.inputVal = '';
  62. this.$emit('moveAllInput',inputVal)
  63. },
  64. changeAllInput(e){
  65. if(e.detail.keyCode==8){
  66. this.$emit('deleteInputVal')
  67. return;
  68. }
  69. this.$emit('deleteInputVal')
  70. // else{
  71. // this.$emit('enteringInputVal',e.detail.value)
  72. // console.log(e.detail.value)
  73. // }
  74. },
  75. },
  76. };
  77. </script>