| | |
| | | </view> |
| | | <view class="date"> |
| | | <picker |
| | | mode='date' |
| | | mode="date" |
| | | :value="startDate" |
| | | @change="evt => handleStartDateChange(evt.detail.value)" |
| | | > |
| | |
| | | </view> |
| | | </picker> |
| | | <picker |
| | | mode='date' |
| | | mode="date" |
| | | :value="endDate" |
| | | @change="evt => handleEndDateChange(evt.detail.value)" |
| | | > |
| | |
| | | </view> |
| | | <view class="date"> |
| | | <picker |
| | | mode='date' |
| | | mode="date" |
| | | :value="date" |
| | | @change="evt => handleDateChange(evt.detail.value)" |
| | | > |
| | |
| | | </view> |
| | | </picker> |
| | | <picker |
| | | mode='time' |
| | | mode="time" |
| | | :value="time" |
| | | @change="evt => handleTimeChange(evt.detail.value)" |
| | | > |
| | |
| | | :step="step" |
| | | :width="120" |
| | | :value="itemRes.formData[itemRes.name]" |
| | | :onChange="evt=>itemRes.onChange(evt)" |
| | | :onChange="evt=>handleChange(evt)" |
| | | /> |
| | | <view class="c-number-step-unit">{{unit}}</view> |
| | | </view> |
| | |
| | | type: Number, |
| | | default: 1, |
| | | }, |
| | | // 奇偶修正 odd 奇数 / even 偶数 |
| | | correct: { |
| | | type: String, |
| | | default: '', |
| | | }, |
| | | // 数值单位 |
| | | unit: { |
| | | type: String, |
| | |
| | | return {}; |
| | | }, |
| | | computed: {}, |
| | | methods: {}, |
| | | methods: { |
| | | handleChange(val) { |
| | | // 奇偶修正模式 |
| | | if (this.correct) { |
| | | const lastValue = this.itemRes.formData[this.itemRes.name]; |
| | | let nextValue = val; |
| | | if ( |
| | | (this.correct === 'odd' && nextValue % 2 === 0) || |
| | | (this.correct === 'even' && nextValue % 2 === 1) |
| | | ) { |
| | | // 增加 |
| | | if (lastValue < nextValue) { |
| | | nextValue++; |
| | | } |
| | | // 减小 |
| | | else if (lastValue > nextValue) { |
| | | nextValue--; |
| | | } |
| | | } |
| | | // 范围 |
| | | nextValue = Math.max(nextValue, this.range[0]); |
| | | nextValue = Math.min(nextValue, this.range[1]); |
| | | this.itemRes.onChange(nextValue); |
| | | } |
| | | // 正常模式 |
| | | else { |
| | | this.itemRes.onChange(val); |
| | | } |
| | | }, |
| | | }, |
| | | mounted() { |
| | | if (process.env.TARO_ENV === 'h5') { |
| | | $(this.$refs.input.$el) |