[bugfix] Dialog: overlay incorrect locate when use getContainer (#3041)

This commit is contained in:
neverland
2019-03-22 16:16:35 +08:00
committed by GitHub
parent c1adaebaa6
commit 784b279738
4 changed files with 20 additions and 15 deletions
+11 -11
View File
@@ -31,7 +31,7 @@ function onClickOverlay(): void {
}
}
function updateOverlay(): void {
export function updateOverlay(): void {
if (!overlay) {
overlay = mount(Overlay, {
on: {
@@ -40,26 +40,26 @@ function updateOverlay(): void {
});
}
if (overlay.$el.parentNode) {
overlay.visible = false;
}
if (context.top) {
const { target, config } = context.top;
const { vm, config } = context.top;
const el = vm.$el;
const target = el && el.parentNode ? el.parentNode : document.body;
if (target) {
target.appendChild(overlay.$el);
}
target.appendChild(overlay.$el);
Object.assign(overlay, defaultConfig, config, {
visible: true
});
} else {
overlay.visible = false;
}
}
export function openOverlay(vm: any, config: OverlayConfig): void {
/* istanbul ignore next */
if (!context.stack.some(item => item.vm === vm)) {
const el = vm.$el;
const target = el && el.parentNode ? el.parentNode : document.body;
context.stack.push({ vm, config, target });
context.stack.push({ vm, config });
updateOverlay();
}
}