crud-input-number.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <el-input-number v-model="text"
  3. class="avue-input-number"
  4. @change="handleChange"
  5. @click.native="handleClick"
  6. :precision="precision"
  7. :size="size"
  8. :min="minRows"
  9. :max="maxRows"
  10. :clearable="disabled?false:clearable"
  11. :readonly="readonly"
  12. :controls-position="controlsPosition"
  13. :label="placeholder?placeholder:`请输入${label}`"
  14. :disabled="disabled"></el-input-number>
  15. </template>
  16. <script>
  17. import create from '../../utils/create';
  18. import crudCompoents from '../../mixins/crud-compoents.js';
  19. export default create({
  20. name: 'crud-input-number',
  21. mixins: [crudCompoents()],
  22. data () {
  23. return {};
  24. },
  25. props: {
  26. value: {
  27. type: Number
  28. },
  29. step: {
  30. type: Number,
  31. default: 1
  32. },
  33. controlsPosition: {
  34. type: String,
  35. default: 'right'
  36. },
  37. precision: {
  38. type: Number,
  39. default: 0
  40. },
  41. minRows: {
  42. type: Number,
  43. default: -Infinity
  44. },
  45. maxRows: {
  46. type: Number,
  47. default: Infinity
  48. }
  49. },
  50. watch: {},
  51. created () { },
  52. mounted () { },
  53. methods: {
  54. handleClick () {
  55. if (typeof this.click === 'function') this.click({ value: this.text, column: this.column });
  56. },
  57. handleChange (value) {
  58. if (typeof this.change === 'function') this.change({ value: value, column: this.column });
  59. this.$emit('input', value);
  60. this.$emit('change', value);
  61. }
  62. }
  63. });
  64. </script>