🐛 显示 overlay 页面进入不加载的问题

This commit is contained in:
BTMuli
2023-05-26 10:58:09 +08:00
parent 2677bc44db
commit 9978becb3b
2 changed files with 26 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<transition enter-from-class="tolo-enter-from" name="tolo"> <transition enter-from-class="tolo-enter-from" name="tolo">
<div v-show="showTolo" class="tolo-box" @click.self.prevent="toClick"> <div v-if="showTolo" class="tolo-box" @click.self.prevent="toClick">
<transition enter-from-class="toli-enter-from" name="toli"> <transition enter-from-class="toli-enter-from" name="toli">
<slot v-if="showToli" /> <slot v-if="showToli" />
</transition> </transition>
@@ -9,25 +9,25 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
import { ref, watch } from "vue"; import { onUpdated, ref, provide, watch, toRefs } from "vue";
interface TolProps { interface TolProps {
modelValue: boolean; modelValue: boolean;
toClick?: () => void; toClick?: () => void;
blurVal: string;
hide?: true;
} }
const showTolo = ref(false); const showTolo = ref(!props.hide);
const showToli = ref(false); const showToli = ref(!props.hide);
const props = withDefaults(defineProps<TolProps>(), { const props = withDefaults(defineProps<TolProps>(), {
modelValue: false, modelValue: false,
blurVal: "20px",
}); });
watch( watch(() => props.modelValue, () => {
() => props.modelValue, if (props.modelValue) {
(v) => {
console.log(v);
if (v) {
showTolo.value = true; showTolo.value = true;
showToli.value = true; showToli.value = true;
} else { } else {
@@ -40,7 +40,6 @@ watch(
} }
}, },
); );
</script> </script>
<style lang="css" scoped> <style lang="css" scoped>
.tolo-enter-active, .tolo-enter-active,
@@ -93,7 +92,7 @@ watch(
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: rgb(0 0 0 / 50%); background: rgb(0 0 0 / 50%);
backdrop-filter: blur(20px); backdrop-filter: blur(v-bind(blurVal));
z-index: 100; z-index: 100;
} }
</style> </style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<TOverlay v-model="visible" :to-click="onCancel"> <TOverlay v-model="visible" :to-click="onCancel" :blur-val="'3px'" hide>
<div class="confirm-div"> <div class="confirm-div">
<div class="confirm-box"> <div class="confirm-box">
<div class="confirm-title"> <div class="confirm-title">
@@ -32,9 +32,11 @@
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
import { computed } from "vue"; import { computed, inject } from "vue";
import TOverlay from "../main/t-overlay.vue"; import TOverlay from "../main/t-overlay.vue";
const test = inject("hide");
interface TOConfirmProps { interface TOConfirmProps {
title: string; title: string;
subtitle?: string; subtitle?: string;
@@ -55,6 +57,7 @@ interface TOConfirmEmits {
const emits = defineEmits<TOConfirmEmits>(); const emits = defineEmits<TOConfirmEmits>();
const props = withDefaults(defineProps<TOConfirmProps>(), { const props = withDefaults(defineProps<TOConfirmProps>(), {
modelValue: false,
title: "确认", title: "确认",
subtitle: "", subtitle: "",
isInput: false, isInput: false,