mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
自定义类型检查。
This commit is contained in:
parent
66f6dad21d
commit
e5b22fbfc9
@ -36,7 +36,12 @@ class DataGrid extends React.Component {
|
||||
DataGrid.propTypes = {
|
||||
className: PropTypes.string,
|
||||
style: PropTypes.object,
|
||||
children: PropTypes.instanceOf(Columns),
|
||||
children: (props, propName, componentName) => {
|
||||
const children = props[propName];
|
||||
if (children.type !== Columns) {
|
||||
return new TypeError(`Invalid prop \`${propName}\` of type \`${children.type.name}\` supplied to \`${componentName}\`, expected \`Columns\`.`);
|
||||
}
|
||||
},
|
||||
data: PropTypes.array,
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user