The right way to describe emits with update #10345
Replies: 2 comments 2 replies
-
https://vuejs.org/api/sfc-script-setup.html#definemodel <script lang="ts" setup>
const defaultModel = defineModel<string>({ default: '' });
const showModel = defineModel<boolean>('show', { default: undefined });
const props = defineProps<{
/* ... */
}>();
const emit = defineEmits<{
/* ... */
}>();
</script> |
Beta Was this translation helpful? Give feedback.
1 reply
-
'update:modelValue': function(modelValue: string) {
return true;
}, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
fairking
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I have the following code:
The question is how do I define emits in a function style way?
Would the above example be correct? Unfortunately I could not find anywhere such examples (even in docs).
Beta Was this translation helpful? Give feedback.
All reactions