i think it's better to use ‘twoWay’ keyword to instead it like vue1.x did,and i think there is a simple way for 'v-model',users need not to emit a input event manually,but just specify the model.prop.
let twoWay back and users dont need emit update event manually because it's complicated to emit event everywhere,and we need not emit inpt event when using v-model,we just need specify model.prop,the vue framework can do the rest better than user.
No, implicitly affecting parent by mutating props is exactly what we want to avoid.
@yyx990803 Maybe we can specify a binding data prop when using props, like this:
javascript
value: {
type: String,
default: 'foo',
bind: 'innnerValue'
}
then it can generate a field called 'innnerValue' on this.$data and its defalut value is 'foo',when we modify this.innnerValue,the framework can emit a 'update:value' event automatically.And,if you modify the prop 'value' by parent,it will update to innnerValue.You can use 'sync' to accept the change,you also can use 'v-model' after you specify model.prop.
Most helpful comment
No, implicitly affecting parent by mutating props is exactly what we want to avoid.