Bug Type: Component
Environment
- Vue Version:
3.6.0-beta.12
- Element Plus Version:
2.14.0
- Browser / OS:
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0
- Build Tool:
Vite
Reproduction
Related Component
Reproduction Link
Element Plus Playground
Steps to reproduce
<template>
<el-config-provider :z-index="0">
<div v-loading="true" style="width: 240px; height: 120px">
loading target
</div>
</el-config-provider>
</template>
What is Expected?
zIndex={0} should be treated as a valid configured value.
What is actually happening?
Components using global z-index settings start from the default initial z-index, such as 2000, instead of starting from 0.
Additional comments
Cause
packages/components/config-provider/src/hooks/use-global-config.ts uses || when creating the z-index override:
computed(() => config.value?.zIndex || defaultInitialZIndex)
Because 0 is falsy in JavaScript, it is replaced with defaultInitialZIndex.
Bug Type:
ComponentEnvironment
3.6.0-beta.122.14.0UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0ViteReproduction
Related Component
el-config-providerReproduction Link
Element Plus Playground
Steps to reproduce
What is Expected?
zIndex={0}should be treated as a valid configured value.What is actually happening?
Components using global z-index settings start from the default initial z-index, such as
2000, instead of starting from0.Additional comments
Cause
packages/components/config-provider/src/hooks/use-global-config.tsuses||when creating the z-index override:Because
0is falsy in JavaScript, it is replaced withdefaultInitialZIndex.