| | |
| | | <template> |
| | | <view |
| | | class="c-input" |
| | | :class="[unit?'c-input-unit':'', readOnly ? 'read-only':'']" |
| | | :class="[unit?'c-input-unit':'', readOnly?'read-only':'']" |
| | | > |
| | | <AtInput |
| | | :name="itemRes.name" |
| | |
| | | :error="itemRes.error" |
| | | :cursorSpacing="0" |
| | | :value="value" |
| | | :onChange="evt => hanldeChange(evt)" |
| | | :onChange="evt => handleChange(evt)" |
| | | > |
| | | <slot v-if="!unit" /> |
| | | <text |
| | |
| | | }, |
| | | }, |
| | | methods: { |
| | | hanldeChange(evt) { |
| | | // 小程序中,可以粘贴换行符进来 |
| | | const changeValue = ((evt || '') + '').replace(/[\n\r]/g, ''); |
| | | handleChange(evt) { |
| | | // 去除首尾空格,小程序中还可以粘贴换行符进来 |
| | | const changeValue = ((evt || '') + '') |
| | | .replace(/^\s+|\s+$/g, '') |
| | | .replace(/[\n\r\t]/g, ''); |
| | | this.itemRes.onChange(changeValue); |
| | | }, |
| | | }, |