fix(components): [select & select-v2] status-icon is invalid (#18101)

fix(components): [select & select-v2] The check result icon is still displayed when status-icon is false

Co-authored-by: 蓝桥春雪 <yj.wang3@sinitek.com>
This commit is contained in:
蓝桥春雪 2024-11-12 20:17:29 +08:00 committed by GitHub
parent a9e6345464
commit 62bade4fda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 2 deletions

View File

@ -229,7 +229,7 @@
<component :is="clearIcon" /> <component :is="clearIcon" />
</el-icon> </el-icon>
<el-icon <el-icon
v-if="validateState && validateIcon" v-if="validateState && validateIcon && needStatusIcon"
:class="[nsInput.e('icon'), nsInput.e('validateIcon')]" :class="[nsInput.e('icon'), nsInput.e('validateIcon')]"
> >
<component :is="validateIcon" /> <component :is="validateIcon" />

View File

@ -135,6 +135,8 @@ const useSelect = (props: ISelectV2Props, emit: SelectEmitFn) => {
const selectDisabled = computed(() => props.disabled || elForm?.disabled) const selectDisabled = computed(() => props.disabled || elForm?.disabled)
const needStatusIcon = computed(() => elForm?.statusIcon ?? false)
const popupHeight = computed(() => { const popupHeight = computed(() => {
const totalHeight = filteredOptions.value.length * props.itemHeight const totalHeight = filteredOptions.value.length * props.itemHeight
return totalHeight > props.height ? props.height : totalHeight return totalHeight > props.height ? props.height : totalHeight
@ -913,6 +915,7 @@ const useSelect = (props: ISelectV2Props, emit: SelectEmitFn) => {
shouldShowPlaceholder, shouldShowPlaceholder,
selectDisabled, selectDisabled,
selectSize, selectSize,
needStatusIcon,
showClearBtn, showClearBtn,
states, states,
isFocused, isFocused,

View File

@ -229,7 +229,7 @@
<component :is="clearIcon" /> <component :is="clearIcon" />
</el-icon> </el-icon>
<el-icon <el-icon
v-if="validateState && validateIcon" v-if="validateState && validateIcon && needStatusIcon"
:class="[nsInput.e('icon'), nsInput.e('validateIcon')]" :class="[nsInput.e('icon'), nsInput.e('validateIcon')]"
> >
<component :is="validateIcon" /> <component :is="validateIcon" />

View File

@ -141,6 +141,8 @@ export const useSelect = (props: ISelectProps, emit) => {
: !isEmptyValue(props.modelValue) : !isEmptyValue(props.modelValue)
}) })
const needStatusIcon = computed(() => form?.statusIcon ?? false)
const showClose = computed(() => { const showClose = computed(() => {
return ( return (
props.clearable && props.clearable &&
@ -826,6 +828,7 @@ export const useSelect = (props: ISelectProps, emit) => {
shouldShowPlaceholder, shouldShowPlaceholder,
currentPlaceholder, currentPlaceholder,
mouseEnterEventName, mouseEnterEventName,
needStatusIcon,
showClose, showClose,
iconComponent, iconComponent,
iconReverse, iconReverse,