Skip to content
Snippets Groups Projects
Commit 31a3748a authored by syuilo's avatar syuilo
Browse files

fix(client): fix z-index bug

parent 48212e7a
No related branches found
No related tags found
No related merge requests found
<template>
<MkModal ref="modal" @click="done(true)" @closed="$emit('closed')">
<MkModal ref="modal" :front="true" @click="done(true)" @closed="$emit('closed')">
<div class="mk-dialog">
<div v-if="icon" class="icon">
<i :class="icon"></i>
......
<template>
<transition :name="$store.state.animation ? popup ? 'modal-popup' : 'modal' : ''" :duration="$store.state.animation ? popup ? 500 : 300 : 0" appear @after-leave="onClosed" @enter="$emit('opening')" @after-enter="childRendered">
<div v-show="manualShowing != null ? manualShowing : showing" v-hotkey.global="keymap" class="qzhlnise" :class="{ front }" :style="{ pointerEvents: (manualShowing != null ? manualShowing : showing) ? 'auto' : 'none', '--transformOrigin': transformOrigin }">
<div class="bg _modalBg" @click="onBgClick" @contextmenu.prevent.stop="() => {}"></div>
<div ref="content" class="content" :class="{ popup, fixed, top: position === 'top' }" @click.self="onBgClick">
<div class="bg _modalBg" :style="{ zIndex }" @click="onBgClick" @contextmenu.prevent.stop="() => {}"></div>
<div ref="content" class="content" :class="{ popup, fixed, top: position === 'top' }" :style="{ zIndex }" @click.self="onBgClick">
<slot></slot>
</div>
</div>
......@@ -11,6 +11,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import * as os from '@/os';
function getFixedContainer(el: Element | null): Element | null {
if (el == null || el.tagName === 'BODY') return null;
......@@ -51,6 +52,7 @@ export default defineComponent({
emits: ['opening', 'click', 'esc', 'close', 'closed'],
data() {
return {
zIndex: os.claimZIndex(this.front),
showing: true,
fixed: false,
transformOrigin: 'center',
......@@ -230,13 +232,8 @@ export default defineComponent({
}
.qzhlnise {
> .bg {
z-index: 10000;
}
> .content:not(.popup) {
position: fixed;
z-index: 10000;
top: 0;
bottom: 0;
left: 0;
......@@ -268,25 +265,10 @@ export default defineComponent({
> .content.popup {
position: absolute;
z-index: 10000;
&.fixed {
position: fixed;
}
}
&.front {
> .bg {
z-index: 20000;
}
> .content:not(.popup) {
z-index: 20000;
}
> .content.popup {
z-index: 20000;
}
}
}
</style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment