bug:
sanmuw opened this issue · 0 comments
sanmuw commented
app.component('my-component', {
props: {
modelValue: String,
modelModifiers: {
default: () => ({})
}
},
emits: ['update:modelValue'],
methods: {
emitValue(e) {
let value = e.target.value
if (this.modelModifiers.capitalize) {
value = value.charAt(0).toUpperCase() + value.slice(1)
}
**value = 'sanmu'**
this.$emit('update:modelValue', value)
}
},
template: <input type="text" :value="modelValue" @input="emitValue">
})
为何 value 写了一个定值 <input type="text" :value="modelValue" @input="emitValue"> 只会修改一次