angular:html2canvas报错提示Unable to find iframe window

问题:

如题

出现时机:

只在 ctrl+r 页面初始化和首次进入目标界面会报错,如果是延时触发,则不会报错

定位:

查看源码,在chrome进行源码修改后打印,定位到报错代码段

TypeScript 复制代码
    const documentCloner = new DocumentCloner(context, element, cloneOptions);
    const clonedElement = documentCloner.clonedReferenceElement;
    if (!clonedElement) {
        return Promise.reject(`Unable to find element in cloned iframe`);
    }
TypeScript 复制代码
if (this.referenceElement === node && isHTMLElementNode(clone)) {
  this.clonedReferenceElement = clone;
}

打印clone,发现直到ion-route-outlet层,后面的节点没有再遍历了,因此出现报错。而界面如果加载完再调用,则无报错。

根本原因:

暂时没有继续深究,感兴趣的可以继续打印查看。

相关推荐
qq_419854051 分钟前
Excel预览
前端
PieroPc10 分钟前
用FastAPI 后端 和 Vue3 前端写一个博客系统 例
前端·vue·fastapi
赵民勇18 分钟前
ES5中prototype和prototype.constructor详解
javascript
xiaoyustudiowww20 分钟前
fetch异步简单版本(Tomcat 9)
java·前端·tomcat
TOPGUS20 分钟前
谷歌Chrome浏览器即将对HTTP网站设卡:突出展示“始终使用安全连接”功能
前端·网络·chrome·http·搜索引擎·seo·数字营销
C_心欲无痕27 分钟前
ts - 模板字面量类型与 `keyof` 的魔法组合:`keyof T & `on${string}`使用
linux·运维·开发语言·前端·ubuntu·typescript
Van_captain28 分钟前
rn_for_openharmony常用组件_Tabs选项卡
javascript·开源·harmonyos
赵民勇30 分钟前
ES6中的const用法详解
javascript·es6
一勺菠萝丶32 分钟前
Java 后端想学 Vue,又想写浏览器插件?
java·前端·vue.js
@PHARAOH37 分钟前
HOW - 如何禁用 localstorage
前端·状态模式