输入框改变

pull/1/head
lilu 2 years ago
parent e2c8db7d93
commit 657cc6b2bb

@ -1884,7 +1884,6 @@ export default {
}
},
getTextareaChange({ type, value }) {
console.log('== 输入框更新 ==', type, value)
this.details[type] = value
// console.log(this.details[type])
this.$forceUpdate()

@ -1,13 +1,14 @@
<template>
<a-textarea
<textarea
class="ant-input"
v-model="value"
:auto-size="{ minRows: 2, maxRows: 5 }"
style="height: 120px"
style="width:100%;display:inline-block;height: 120px"
@blur="textareaBlur"
@change="textareaChange"
/>
@input="debounce(textareaChange, 300, $event)"
></textarea>
</template>
<script>
let timer;
export default {
name: '',
props: {
@ -22,16 +23,25 @@ export default {
},
data() {
return {
value: this.parentVal || ''
value: this.parentVal || '',
inEdit: false
}
},
watch: {
parentVal(nval, oval) {
if (this.inEdit) { return false }
console.log('== 回传赋值 ==', nval)
this.value = nval
}
},
mounted() {},
methods: {
debounce (func, wait, ...args) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
func.apply(this, args);
}, wait);
},
textareaBlur() {
this.$emit('getTextareaChange', {
type: this.type,
@ -39,12 +49,14 @@ export default {
})
},
textareaChange(e) {
// if (e.type === 'click' && !this.value) {
this.inEdit = true
setTimeout(() => {
this.inEdit = false
}, 800)
this.$emit('getTextareaChange', {
type: this.type,
value: this.value
})
// }
}
}
}

Loading…
Cancel
Save