父组件:
<template><child-componentv-model:value="popoverVisible"/>
</template>const popoverVisible = ref(false);
子组件:
<script lang="ts" setup>const props = withDefaults(defineProps<{value: boolean;}>(),{value: false,//设置默认值},);//props简写如下const props = defineProps(['value'])const emits = defineEmits<{(event: "update:value", payload: boolean): void;}>();//emits简写如下const emits = defineEmits(['update:value']);const show=()=>{emits("update:value", true)}
</script>