|
@@ -0,0 +1,43 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <Teleport to="body">
|
|
|
+ <div class="demo">
|
|
|
+ <h3>demo</h3>
|
|
|
+ <button @click="openWindows">开启弹框</button>
|
|
|
+ <button @click="closeWindows">关闭弹框</button>
|
|
|
+ <div class="dialog" v-if="isShow"></div>
|
|
|
+ </div>
|
|
|
+ </Teleport>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import {ref,reactive} from "vue"
|
|
|
+let isShow = ref(false)
|
|
|
+function openWindows() {
|
|
|
+ isShow.value = true;
|
|
|
+}
|
|
|
+function closeWindows() {
|
|
|
+ isShow.value = false;
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.demo {
|
|
|
+ width: 400px;
|
|
|
+ height: 400px;
|
|
|
+ color: #fff;
|
|
|
+ background: #00f;
|
|
|
+ text-align: center;
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ margin-left: -200px;
|
|
|
+ margin-top: -200px;
|
|
|
+}
|
|
|
+.dialog {
|
|
|
+ width: 300px;
|
|
|
+ height: 300px;
|
|
|
+ background: #ff0;
|
|
|
+}
|
|
|
+</style>
|