This commit is contained in:
guochunsi
2026-01-30 16:29:15 +08:00
parent 53f71066f3
commit c6da6e286f
70 changed files with 688 additions and 519 deletions

View File

@@ -41,14 +41,13 @@ const props = withDefaults(defineProps<Props>(), {
emptyText: '-'
})
// 根据 state 值查找对应的配置
// 根据 state 值查找对应的配置(统一转字符串比较,兼容数字 10 与字符串 '10'
const currentOption = computed(() => {
if (!props.state && props.state !== 0 && props.state !== '0') {
if (props.state == null || props.state === '') {
return null
}
return props.options.find(option => {
return String(option.value) === String(props.state)
}) || null
const stateStr = String(props.state)
return props.options.find(option => String(option.value) === stateStr) || null
})
</script>

View File

@@ -37,13 +37,13 @@ const props = withDefaults(defineProps<Props>(), {
// 默认的类型映射(只使用字符串键)
const defaultTypeMap: Record<string, { type: string; effect: string }> = {
'1': { type: 'warning', effect: 'dark' },
'1': { type: 'danger', effect: 'dark' },
'0': { type: 'primary', effect: 'light' }
}
// 默认的颜色映射(只使用字符串键)
const defaultColorMap: Record<string, string> = {
'1': 'var(--el-color-warning)',
'1': 'var(--el-color-danger)',
'0': 'var(--el-color-primary)'
}