useVModel
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
July 8
Free AI Workshop
Build smarter apps with LLMs, agents, MCPs, and advanced AI tooling
July 8