| | |
| | | /> |
| | | <view |
| | | class="c-number-step-step" |
| | | :class="unit?'on-unit':''" |
| | | :class="[unit?'on-unit':'', isEmpty?'on-empty':'']" |
| | | ref="number" |
| | | > |
| | | <AtInputNumber |
| | |
| | | data() { |
| | | return {}; |
| | | }, |
| | | computed: {}, |
| | | computed: { |
| | | // 空值判断,弥补空值时显示最小值的问题 |
| | | isEmpty() { |
| | | const curVal = this.itemRes.formData[this.itemRes.name]; |
| | | if (typeof curVal === 'undefined') { |
| | | return true; |
| | | } else if (!curVal && curVal !== 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | handleChange(val) { |
| | | // 奇偶修正模式 |
| | | if (this.correct) { |
| | | const lastValue = |
| | | this.itemRes.formData[this.itemRes.name] || this.range[0]; |
| | | const lastValue = this.isEmpty |
| | | ? this.range[0] |
| | | : this.itemRes.formData[this.itemRes.name]; |
| | | let nextValue = val; |
| | | if ( |
| | | (this.correct === 'odd' && nextValue % 2 === 0) || |
| | |
| | | color: #999; |
| | | } |
| | | } |
| | | &.on-empty { |
| | | .at-input-number { |
| | | input { |
| | | color: transparent; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |