mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: 修复 app 模式页面定义 definitions 无效的问题 Close: #4679
This commit is contained in:
parent
ea7a306143
commit
9e0c9ba582
@ -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>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user