onUpdate:modelValue is not being passed to root when modelValue is declared
Version
3.2.6
Reproduction link
Steps to reproduce
- Try to write something on the input and see if the msg is reactively rendered on h1 (it doesn't).
- Go to
CustomTextInput.vue
, and addv-bind="$attrs"
to the text-field, then write at the input. It works. - Remove the bind, and then also remove the
modelValue
declaration and bind. It works.
What is expected?
It is expected that the handler onUpdate:modelValue
always be passed to the root element, since inheritAttrs
is true by default.
What is actually happening?
The attr onUpdate:modelValue
exists but is not being passed when we declare a modelValue
prop
You need to remove the prop from custom text input so it doesn't treat it as a v-model value and automatically handle the emit too (similar to having the emit defined https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8aDE+e3sgbXNnIH19PC9oMT5cbiAgPGN1c3RvbS10ZXh0LWlucHV0IHYtbW9kZWw9XCJtc2dcIiAvPlxuPC90ZW1wbGF0ZT5cblxuPHNjcmlwdD5cbmltcG9ydCB7IHJlZiB9IGZyb20gJ3Z1ZSdcbmltcG9ydCBDdXN0b21UZXh0SW5wdXQgZnJvbSAnLi9DdXN0b21UZXh0SW5wdXQudnVlJ1xuXG5leHBvcnQgZGVmYXVsdCB7XG4gIGNvbXBvbmVudHM6IHtcbiAgICBDdXN0b21UZXh0SW5wdXRcbiAgfSxcbiAgc2V0dXAoKSB7XG4gICAgY29uc3QgbXNnID0gcmVmKCk7XG4gICAgXG4gICAgcmV0dXJuIHtcbiAgICAgIG1zZ1xuICAgIH1cbiAgfVxufVxuPC9zY3JpcHQ+IiwiVGV4dElucHV0LnZ1ZSI6Ijx0ZW1wbGF0ZT5cblx0PGlucHV0IFxuICAgIEBpbnB1dD1cIiRlbWl0KCd1cGRhdGU6bW9kZWxWYWx1ZScsICRldmVudC50YXJnZXQudmFsdWUpXCIgXG4gICAgOnZhbHVlPVwibW9kZWxWYWx1ZVwiIFxuICAvPlxuPC90ZW1wbGF0ZT5cblxuPHNjcmlwdD5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgcHJvcHM6IHtcbiAgICBtb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