<teleport to="body">
<error v-if="inValid">
<template #header>
<h2 class="text-danger">the Error</h2>
</template>
<template #content>
<p>
please enter the valid data to input !!!
</p>
<button class="btn btn-success" @click="close">click to close</button>
</template>
</error>
</teleport>
npm i portal-vue --save
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<div id="dialogs">{/div
<script type="module" src="/src/main.js"></script>
</body>
</html>
<template>
<teleport to="#dialogs">
<div class="the-dialog">
<div class="the-dialog_container">
<div class="the-dialog_header">
{{ heading }}
</div>
Oreferences
<div class="the-dialog_body"><slot></slot></div>
</div>
</div>
</teleport>
</template>
<button @click="open = true">Open Modal</button>
<Teleport to="body">
<div v-if="open" class="modal">
<p>Hello from the modal!</p>
<button @click="open = false">Close</button>
</div>
</Teleport>