跳到主要内容

场景

2023年09月21日
柏拉文
越努力,越幸运

一、Modal


<template>
<button @click="handleShowModel(true)">显示 Model</button>
<Teleport to="body">
<Modal :show="isShowModel" @setShow="handleShowModel">
<template #header>
<h3>Modal 标题</h3>
</template>
</Modal>
</Teleport>
</template>

<script setup>
import { ref } from 'vue';
import Modal from './components/Modal.vue';

const isShowModel = ref(false);

const handleShowModel = value => {
isShowModel.value = value;
};
</script>