Merge pull request #2218 from 2betop/mattrixCheckboxes

fix: matrixCheckboxes 如果直接 form 外面有可能报错
This commit is contained in:
RickCole 2021-07-05 16:22:02 +08:00 committed by GitHub
commit b4092df595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,9 +109,7 @@ export default class MatrixCheckbox extends React.Component<
componentDidMount() {
const {formInited, addHook} = this.props;
formInited || !addHook
? this.reload()
: addHook?.(this.initOptions, 'init');
formInited || !addHook ? this.reload() : addHook(this.initOptions, 'init');
}
componentDidUpdate(prevProps: MatrixProps) {
@ -146,7 +144,7 @@ export default class MatrixCheckbox extends React.Component<
componentWillUnmount() {
this.mounted = false;
const {removeHook} = this.props;
removeHook(this.initOptions, 'init');
removeHook?.(this.initOptions, 'init');
}
async initOptions(data: any) {