Last active
September 14, 2024 19:17
-
-
Save Tofu-Xx/fa475844f9d60c7bb8378c1e5e3ad2d5 to your computer and use it in GitHub Desktop.
Optimal implementation of v-model's components communicate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup lang="ts"> | |
let modelValue = defineModel("modelValue", { default: () => (0) }) | |
const ins = () => modelValue.value++ | |
</script> | |
<template> | |
<button @click="ins">{{ modelValue }}</button> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup lang="ts"> | |
export let modelValue: number = 0 | |
const ins = () => modelValue++ | |
</script> | |
<template> | |
<button @click="ins">{{ modelValue }}</button> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://vue-macros.dev/features/export-props.html