Skip to content

Commit cb2fdec

Browse files
committed
fix(options): 修复点击事件
1 parent b5b8714 commit cb2fdec

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/content/components/Checkbox.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface CheckboxProps {
1212
onChange?: ChangeEventHandler<HTMLInputElement>
1313
size?: number
1414
color?: string
15+
id?: string
1516
}
1617

1718
const Checkbox: FC<CheckboxProps> = ({
@@ -20,6 +21,7 @@ const Checkbox: FC<CheckboxProps> = ({
2021
onChange,
2122
size,
2223
color,
24+
id,
2325
}) => {
2426
const Icon = indeterminate
2527
? CheckBoxIndeterminateIcon
@@ -39,6 +41,7 @@ const Checkbox: FC<CheckboxProps> = ({
3941
`}
4042
>
4143
<input
44+
id={id}
4245
type="checkbox"
4346
checked={checked}
4447
onChange={chandleChange}

src/options/Option.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,16 @@ const Option: FC = () => {
9191
justify-content: flex-end;
9292
`}
9393
>
94-
<span>{hasEnable ? '全部禁用' : '全部启用'}</span>
94+
<label
95+
htmlFor="selectAll"
96+
css={css`
97+
cursor: pointer;
98+
`}
99+
>
100+
{hasEnable ? '全部禁用' : '全部启用'}
101+
</label>
95102
<Checkbox
103+
id="selectAll"
96104
checked={hasEnable}
97105
indeterminate={indeterminate}
98106
onChange={() =>

0 commit comments

Comments
 (0)