mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
Merge pull request #1812 from 2betop/jssdk
修复app 渲染器页面 schemaApi 用法会存在 api 请求混乱问题
This commit is contained in:
commit
23a99afee1
@ -571,6 +571,22 @@ export const examples = [
|
||||
jumpTo: (to: string) => {
|
||||
location.hash = to;
|
||||
},
|
||||
updateLocation: (to, replace) => {
|
||||
if (to === 'goBack') {
|
||||
return window.history.back();
|
||||
}
|
||||
|
||||
if (replace && window.history.replaceState) {
|
||||
window.history.replaceState(
|
||||
'',
|
||||
document.title,
|
||||
normalizeLink(to)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
window.history.pushState('', document.title, normalizeLink(to));
|
||||
},
|
||||
isCurrentUrl: (to: string, ctx: any) => {
|
||||
if (!to) {
|
||||
return false;
|
||||
|
@ -386,7 +386,7 @@ export default class App extends React.Component<AppProps, object> {
|
||||
) : null}
|
||||
|
||||
{render('page', store.schema, {
|
||||
key: store.activePage?.id,
|
||||
key: `${store.activePage?.id}-${store.schemaKey}`,
|
||||
data: store.pageData
|
||||
})}
|
||||
</>
|
||||
|
@ -162,7 +162,9 @@ export const AppStore = ServiceStore.named('AppStore')
|
||||
|
||||
if (page.schema) {
|
||||
self.schema = page.schema;
|
||||
self.schemaKey = '' + Date.now();
|
||||
} else if (page.schemaApi) {
|
||||
self.schema = null;
|
||||
self.fetchSchema(page.schemaApi, self.activePage);
|
||||
} else if (page.redirect) {
|
||||
env.jumpTo(page.redirect);
|
||||
@ -171,6 +173,7 @@ export const AppStore = ServiceStore.named('AppStore')
|
||||
this.rewrite(page.rewrite, env);
|
||||
} else {
|
||||
self.schema = null;
|
||||
self.schemaKey = '';
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user