Subscribe on changes!

v-model modifiers can break emitting an update event if some parameter is not a string

avatar
Apr 20th 2022

Version

3.2.33

Reproduction link

sfc.vuejs.org

Steps to reproduce

  • Click ""update" button -> no error
  • Click "update with extra data" -> error a.trim is not a function

What is expected?

I would like to pass any type of value to update:xxx event

What is actually happening?

If v-model is used with built-in modifiers, e.g. trim or number then I cannot emit the update:xxx event if passed some parameter is not a string. Let's say i have custom Input component where I would like to pass additional data to update:modelValue event, e.g. an object with field name but currently, as shown in the demo, if I use trim modifiers, emitting such an event is not possible.

Looks like the issue is in these lines of code componentEmits.ts#L124

avatar
Apr 20th 2022

Seems you spotted the right place. Up for a PR?

avatar
Apr 21st 2022

Hi, I create a PR to fix this issue, see #5770.

avatar
Apr 27th 2022

any update?