feat(components): 为 Check 和 Radio 组件添加禁用状态样式

- 在 Check 和 Radio 组件的父容器上添加 classList 属性
- 根据 mProps.disabled 的值动态设置 'text-neutral' 类
- 优化组件结构,提高可读性和可维护性
This commit is contained in:
Vixalie
2025-08-12 22:18:49 +08:00
parent 2e253ff04c
commit 032e3af282
2 changed files with 8 additions and 2 deletions

View File

@@ -49,7 +49,10 @@ const Check: ParentComponent<CheckBoxProps> = (props) => {
};
return (
<div class="flex flex-row items-center gap-1 cursor-pointer" onClick={handleClick}>
<div
class="flex flex-row items-center gap-1 cursor-pointer"
classList={{ 'text-neutral': mProps.disabled }}
onClick={handleClick}>
<Dynamic component={CheckIcon[internalChecked() ? 1 : 0]} />
<div>{mProps.children}</div>
<Show when={isNotNil(mProps.name)}>

View File

@@ -49,7 +49,10 @@ const Radio: ParentComponent<RadioProps> = (props) => {
};
return (
<div class="flex flex-row items-center gap-1 cursor-pointer" onClick={handleClick}>
<div
class="flex flex-row items-center gap-1 cursor-pointer"
classList={{ 'text-neutral': mProps.disabled }}
onClick={handleClick}>
<Dynamic component={RadioIcon[internalChecked() ? 1 : 0]} />
<div>{mProps.children}</div>
<Show when={isNotNil(mProps.name)}>