CnumberBox.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="main">
  3. <uni-icons type="minus-filled" size="20" color="#A67A54" @click="numReduce"></uni-icons>
  4. <!-- <text class="buy-select">{{number}}</text> -->
  5. <!-- <u-input
  6. v-model="number"
  7. type="number"
  8. height="40"
  9. :placeholder="placeholder"
  10. :clearable="false"
  11. :disabled="isDisabled"
  12. input-align="center"
  13. :custom-style="{width:'45px'}"
  14. @input="onKeyInput"/> -->
  15. <!-- <input class="uni-input" v-model="number" :type="isInt?'number' : 'digit'" :disabled="isDisabled" :placeholder="placeholder" @input="onKeyInput" > -->
  16. <input class="uni-input" :value="number" :type="isInt?'number' : 'digit'" :disabled="isDisabled" :placeholder="placeholder" @input="onKeyInput" >
  17. <uni-icons type="plus-filled" size="20" color="#A67A54" @click="numPlus"></uni-icons>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. props: {
  23. number: {
  24. default: 1
  25. },
  26. isDisabled: {
  27. default: false
  28. },
  29. isInt: {
  30. default: true
  31. },
  32. placeholder: {
  33. default: ''
  34. },
  35. step: {
  36. default: 1
  37. },
  38. minNum: {
  39. default: 0.01
  40. }
  41. },
  42. data() {
  43. return {
  44. }
  45. },
  46. methods: {
  47. onKeyInput(event) {
  48. let i = event.target.value
  49. this.$emit('onKeyInput',i)
  50. },
  51. numPlus() {
  52. this.$emit('numPlus',this.number,);
  53. },
  54. numReduce() {
  55. this.$emit('numReduce',this.number,);
  56. }
  57. }
  58. }
  59. </script>
  60. <style>
  61. </style>
  62. <style lang="less" scoped>
  63. .main {
  64. display: flex;
  65. align-items: center;
  66. justify-content: flex-end;
  67. .uni-input {
  68. height: 40px;
  69. width: 45px;
  70. text-align: center;
  71. }
  72. }
  73. </style>