Optimize attr inputer

This commit is contained in:
2022-03-08 13:53:08 +08:00
parent 8f5fff920f
commit 45975cafe7
5 changed files with 82 additions and 54 deletions
+5
View File
@@ -142,6 +142,11 @@ class AttrInput extends Component<IAttrInputProps> {
return true;
}
public constructor(props: IAttrInputProps) {
super(props);
this.updateValueFromProps(props.value);
}
private updateValueFromProps(val: IAttrInputProps["value"]) {
const value = val ?? (this.props.isNumber ? "0" : "");
this.value = value.toString();