mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持页面层定义 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
|
||||
handleNavClick(e: React.MouseEvent) {
|
||||
e.preventDefault();
|
||||
@ -511,7 +524,8 @@ export default class App extends React.Component<AppProps, object> {
|
||||
<div className={cx('AppBody')}>
|
||||
{render('page', store.schema, {
|
||||
key: `${store.activePage?.id}-${store.schemaKey}`,
|
||||
data: store.pageData
|
||||
data: store.pageData,
|
||||
resolveDefinitions: this.resolveDefinitions
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
|
Loading…
Reference in New Issue
Block a user