Skip to content

Commit

Permalink
feat(checkbox): support readonly (#1578)
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 authored Sep 11, 2024
1 parent f23c611 commit 2039cfa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/checkbox/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ maxContentRow | Number | 5 | 内容最大行数限制 | N
maxLabelRow | Number | 3 | 主文案最大行数限制 | N
name | String | - | HTML 元素原生属性 | N
placement | String | left | 多选框和内容相对位置。可选项:left/right | N
readonly | Boolean | false | 【暂不支持】只读状态 | N
readonly | Boolean | false | 只读状态 | N
value | String / Number / Boolean | - | 多选框的值。TS 类型:`string \| number \| boolean` | N
onChange | Function | | TS 类型:`(checked: boolean, context: { e: Event }) => void`<br/>值变化时触发 | N

Expand Down
2 changes: 1 addition & 1 deletion src/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default defineComponent({
});

const handleChange = (e: Event, source?: string) => {
if (isDisabled.value) return;
if (isDisabled.value || props.readonly) return;
if (source === 'text' && props.contentDisabled) return;

const value = !isChecked.value;
Expand Down
2 changes: 1 addition & 1 deletion src/checkbox/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default {
return ['left', 'right'].includes(val);
},
},
/** 【暂不支持】只读状态 */
/** 只读状态 */
readonly: Boolean,
/** 多选框的值 */
value: {
Expand Down
2 changes: 1 addition & 1 deletion src/checkbox/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface TdCheckboxProps {
*/
placement?: 'left' | 'right';
/**
* 【暂不支持】只读状态
* 只读状态
* @default false
*/
readonly?: boolean;
Expand Down

0 comments on commit 2039cfa

Please sign in to comment.