Skip to content

useVModel

Category
Export Size
533 B
Last Changed
2 years ago
Related

Shorthand for v-model binding, props + emit -> ref

Usage

js
import { useVModel } from '@vueuse/core'

export default {
  setup(props, { emit }) {
    const data = useVModel(props, 'data', emit)

    console.log(data.value) // props.data
    data.value = 'foo' // emit('update:data', 'foo')
  },
}

<script setup>
Free AI Workshop
Build smarter apps with LLMs, agents, MCPs, and advanced AI tooling
Boost Your Workflow
July 8