Skip to content

Commit

Permalink
feat: disabled & visible 支持 boolean 类型可控配置
Browse files Browse the repository at this point in the history
  • Loading branch information
stulip committed Aug 29, 2023
1 parent cc9aee6 commit 7379daa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CCField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ export class CCFieldWrapper extends Component<ICCField, CCFieldState> {

function p2s(name: keyof ICCField) {
const value = nextProps[name];
if (!Types.isUndefined(value) && value !== prevState[`_${name}`]) {
if (!Types.isUndefined(value) && !Types.isFunction(value) && value !== prevState[`_${name}`]) {
state = state || {};
state[name] = value;
state[`_${name}`] = value;
}
}

// @ts-ignore
['value'].forEach(p2s);
['value', 'disabled', 'visible'].forEach(p2s);
return state;
}

Expand Down

0 comments on commit 7379daa

Please sign in to comment.