| Category | Component |
|---|---|
| Export Size | 562 B |
| Last Changed | 9 months ago |
| Related | useVModel |
Shorthand for props v-model binding. Think it like toRefs(props) but changes will also trigger emit.
import { useVModels } from '@vueuse/core'
export default {
props: {
foo: String,
bar: Number,
},
setup(props, { emit }) {
const { foo, bar } = useVModels(props, emit)
console.log(foo.value) // props.foo
foo.value = 'foo' // emit('update:foo', 'foo')
},
}
/** * Shorthand for props v-model binding. Think like `toRefs(props)` but changes will also emit out. * * @see https://vueuse.org/useVModels * @param props * @param emit */ export declare function useVModels<P extends object, Name extends string>( props: P, emit?: (name: Name, ...args: any[]) => void, options?: UseVModelOptions<any> ): ToRefs<P>
© 2019-present Anthony Fu
Licensed under the MIT License.
https://vueuse.org/core/useVModels/