iframe的src从page的initApi中获取 出错 DataCloneError: Failed to execute 'postMessage' on 'Window': HTMLDocument object could not be cloned.
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 18.9k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
实现场景:
我想在iframe外部通过initApi调接口将需要的动态参数设置到数据域,然后iframe通过表达式动态生成src地址,但是报错DataCloneError: Failed to execute 'postMessage' on 'Window': HTMLDocument object could not be cloned.
存在的问题:

当前方案:
{
"type": "page",
"bodyClassName": "h-screen",
"className": "h-screen",
"body": [
{
"type": "iframe",
"src": "/eccom/modelconfig/appproject.site/${project.options.AppProject.id}",
"height": "100%",
"bodyClassName": "h-screen",
"className": "h-screen",
"width": "100%"
}
],
"initFetch": true,
"data": {
"method": "get",
"url": "/lb.con/api/hxProject"
},
"messages": {
},
"style": {
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported configuration using an iframe, an initApi or initFetch request, and the expression-based src value. Trace the iframe data flow around initApi and postMessage to identify why an HTMLDocument enters the message payload; done means the dynamic src is passed without DataCloneError and the reported scenario works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100