chore: iframe 的 src 支持非纯变量的数据映射 Closes #2939 (#2943)

This commit is contained in:
吴多益 2021-11-15 13:37:41 +08:00 committed by GitHub
parent 5b4ec444dc
commit 3db2fff72c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

View File

@ -28,11 +28,11 @@ order: 51
{
"type": "page",
"data": {
"iframeSrc": "https://gitee.com/baidu/amis"
"iframeSrc": "baidu/amis"
},
"body": {
"type": "iframe",
"src": "${iframeSrc}",
"src": "https://gitee.com/${iframeSrc}",
"height": 300
}
}

View File

@ -42,7 +42,7 @@ let amisScoped = amis.embed(
如果是其它语言,比如目前德语,需要单独引入文件
```html
```
<script src="sdk.js"></script>
<script src="locale/de-DE.js"></script>
<script type="text/javascript">

View File

@ -6,7 +6,7 @@ import {ScopedContext, IScopedContext} from '../Scoped';
import {buildApi, isApiOutdated} from '../utils/api';
import {BaseSchema, SchemaUrlPath} from '../Schema';
import {ActionSchema} from './Action';
import {isPureVariable, resolveVariableAndFilter} from '../utils/tpl-builtin';
import {dataMapping} from '../utils/tpl-builtin';
/**
* IFrame
@ -161,9 +161,7 @@ export default class IFrame extends React.Component<IFrameProps, object> {
...style
};
if (isPureVariable(src)) {
src = resolveVariableAndFilter(src, data, '| raw');
}
src = dataMapping(src, data);
const finalSrc = src ? buildApi(src, data).url : undefined;