fix: 修复 app 模式页面定义 definitions 无效的问题 Close: #4679

This commit is contained in:
2betop 2024-03-26 15:43:13 +08:00
parent ea7a306143
commit 9e0c9ba582

View File

@ -286,6 +286,19 @@ export default class App extends React.Component<AppProps, object> {
this.reload(); this.reload();
} }
/**
* definitions definitions
* @param name
* @returns
*/
@autobind
resolveDefinitions(name: string) {
const {resolveDefinitions, store} = this.props;
const definitions = store.schema?.definitions;
return definitions?.[name] || resolveDefinitions(name);
}
@autobind @autobind
handleNavClick(e: React.MouseEvent) { handleNavClick(e: React.MouseEvent) {
e.preventDefault(); e.preventDefault();
@ -511,7 +524,8 @@ export default class App extends React.Component<AppProps, object> {
<div className={cx('AppBody')}> <div className={cx('AppBody')}>
{render('page', store.schema, { {render('page', store.schema, {
key: `${store.activePage?.id}-${store.schemaKey}`, key: `${store.activePage?.id}-${store.schemaKey}`,
data: store.pageData data: store.pageData,
resolveDefinitions: this.resolveDefinitions
})} })}
</div> </div>
</> </>