Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

三层嵌套vue项目时报错:Cannot redefine property: href #1549

Closed
252352801 opened this issue Mar 12, 2025 · 4 comments
Closed

三层嵌套vue项目时报错:Cannot redefine property: href #1549

252352801 opened this issue Mar 12, 2025 · 4 comments
Assignees
Labels
fixed Issue fixed

Comments

@252352801
Copy link

问题描述

问题的具体描述
在3层嵌套vue页面场景下(应用a>应用b>应用c),当应用c页面包含a标签时,无法加载应用c,应用c页面空白。
浏览器console报错:Cannot redefine property: href

复现步骤

1.应用a加载应用b,应用b加载应用c,3个应用均为vue2项目
2.应用c被加载页面包含a标签(无a标签时表现正常)

上传截图

Image

复现仓库

https://github.com/252352801/microApp_href_defineProperties_bug

环境信息

micro-app版本:1.0.0-rc.20
主应用前端框架&版本:vue@^2.6.14
子应用前端框架&版本:vue@^2.6.14
构建工具&版本:[email protected][email protected]


ps:已针对该问题提交一个pr:#1528

@timhub66 timhub66 added the Need Reproduction 需要复现步骤 label Mar 13, 2025
Copy link

Hello @252352801. In order to facilitate location and troubleshooting, we need you to provide a realistic GitHub repository.
您好 @252352801, 为了方便定位和排查问题,我们需要您提供一个重现实例,请提供一个尽可能精简的 GitHub 仓库地址。

@timhub66 timhub66 added Working on it Working on this issue and removed Need Reproduction 需要复现步骤 labels Mar 13, 2025
@timhub66 timhub66 self-assigned this Mar 18, 2025
@timhub66
Copy link
Collaborator

@timhub66 timhub66 added fixed Issue fixed and removed Working on it Working on this issue labels Mar 18, 2025
Copy link

Hello @252352801. The issue you reported has been fixed. This issue will be closed. Thank you for your feedback.
您好 @252352801,您反馈的问题已修复,该 issue 将要被关闭,感谢反馈。

@252352801
Copy link
Author

改用iframe模式即可,https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/configure?id=iframe

您好,我这边有尝试过iframe模式,iframe沙箱没有这个问题,但是会有其他难以重现的问题。比如会偶发地出现跨站错误(父、子应用都在首页及empty.html页面head>script设置了相同的domain,若不设置,将必现)。基于解决问题的难度最终暂时放弃了iframe沙箱方案。

目前项目是通过fork的源码在报错部分加了判断解决的,参考PR:https://github.com/jd-opensource/micro-app/pull/1528/files
不知能否按这样解决?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Issue fixed
Projects
None yet
Development

No branches or pull requests

2 participants