mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix(design): popover zindex不生效
This commit is contained in:
parent
d4408aaa32
commit
e53c0e1ce5
@ -39,8 +39,6 @@ const props = withDefaults(defineProps<PopoverProps>(), {
|
||||
visible: undefined,
|
||||
});
|
||||
|
||||
const zIndex = useZIndex();
|
||||
const curZIndex = ref<number>(2);
|
||||
const popoverVisible = ref(false);
|
||||
|
||||
const visibleWatch = watch(
|
||||
@ -85,11 +83,12 @@ onMounted(() => {
|
||||
referenceElementRef.value = getCurrentInstance()?.proxy?.$el.nextElementSibling;
|
||||
});
|
||||
|
||||
const zIndex = useZIndex();
|
||||
watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
|
||||
destroy();
|
||||
if (!referenceElement || !popperElement) return;
|
||||
|
||||
popperElement.style.zIndex = `${curZIndex.value}`;
|
||||
popperElement.style.zIndex = `${zIndex.nextZIndex()}`;
|
||||
popperElement.focus();
|
||||
|
||||
instanceRef.value = createPopper(referenceElement, popperElement, {
|
||||
@ -132,7 +131,7 @@ const mouseleaveHandler = () => {
|
||||
|
||||
timer = setTimeout(() => {
|
||||
popoverVisible.value = false;
|
||||
}, 300);
|
||||
}, 500);
|
||||
};
|
||||
|
||||
if (props.trigger === 'click' && typeof props.visible === 'undefined') {
|
||||
@ -170,21 +169,6 @@ if (props.trigger === 'hover' && typeof props.visible === 'undefined') {
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
popoverVisible,
|
||||
(popoverVisible) => {
|
||||
if (!popoverVisible) {
|
||||
return;
|
||||
}
|
||||
nextTick().then(() => {
|
||||
curZIndex.value = zIndex.nextZIndex();
|
||||
});
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
);
|
||||
|
||||
const destroy = () => {
|
||||
if (!instanceRef.value) return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user