Skip to content

How to use useVModel/useVModels with script setup? #856

Answered by wheatjs
darrylnoakes asked this question in Q&A
Discussion options

You must be logged in to vote

In <script setup> you can use defineProps and defineEmits

So it would look something like

<script setup>
import { useVModel } from '@vueuse/core'

const props = defineProps({ data: String })
const emit = defineEmits(['update:data'])
const data = useVModel(props, data, emit)
</script>

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@darrylnoakes
Comment options

@cberthiaume
Comment options

@mgnrfk
Comment options

Answer selected by darrylnoakes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #854 on October 19, 2021 04:12.