Home > Enterprise >  What is the pupose "@update:model-value " in vue and how it works?
What is the pupose "@update:model-value " in vue and how it works?

Time:06-07

I looked for a lot to find the example in order to understand the following code but useless. If you can share the link where I can read about that or write the example with the parent and the child components. I will be grateful

<q-input
      :model-value="modelValue"
      @update:model-value=""
>

CodePudding user response:

In version 3.x, v-model in a custom component is equivalent to passing a prop modelValue and emitting an event update:modelValue.

<ChildComponent v-model="pageTitle" />

<!-- would be a shortcut to -->

<ChildComponent
  :modelValue="pageTitle"
  @update:modelValue="pageTitle = $event"
/>

CodePudding user response:

Read this from the Vue docs

Its essentially what v-model does but sometime you might want to modify it for your own use case

  • Related