From a1deb26770e0ffb2ee32ea4f2c23d7ed6c0bd138 Mon Sep 17 00:00:00 2001 From: betavs <34408516+betavs@users.noreply.github.com> Date: Sun, 1 Oct 2023 00:58:27 -0500 Subject: [PATCH] fix(components): [popper] invalid when props z-index is zero (#14375) --- .../components/popper/src/composables/use-content-dom.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/components/popper/src/composables/use-content-dom.ts b/packages/components/popper/src/composables/use-content-dom.ts index 0022ba07f3..753684b27c 100644 --- a/packages/components/popper/src/composables/use-content-dom.ts +++ b/packages/components/popper/src/composables/use-content-dom.ts @@ -1,6 +1,7 @@ import { computed, ref, unref } from 'vue' import { useNamespace, useZIndex } from '@element-plus/hooks' +import { isNumber } from '@element-plus/utils' import type { CSSProperties, StyleValue } from 'vue' import type { UsePopperReturn } from '@element-plus/hooks' import type { UsePopperContentReturn } from './use-content' @@ -19,7 +20,9 @@ export const usePopperContentDOM = ( const ns = useNamespace('popper') const contentAttrs = computed(() => unref(attributes).popper) - const contentZIndex = ref(props.zIndex || nextZIndex()) + const contentZIndex = ref( + isNumber(props.zIndex) ? props.zIndex : nextZIndex() + ) const contentClass = computed(() => [ ns.b(), ns.is('pure', props.pure), @@ -41,7 +44,7 @@ export const usePopperContentDOM = ( ) const updateZIndex = () => { - contentZIndex.value = props.zIndex || nextZIndex() + contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex() } return {