简体   繁体   English

同一页面中的多个 web 组件在 chrome 中出现错误,例如无法读取 Angular 中未定义(读取创建)的属性

[英]Multiple web components in same page giving error in chrome like cannot read properties of undefined (reading create) in Angular

Created two web components: web-comp-1, web-comp-2创建了两个 web 组件:web-comp-1、web-comp-2

When I tried to add in HTML page, I am getting console error like below当我尝试添加 HTML 页面时,出现如下控制台错误

Uncaught TypeError: Cannot read properties of undefined (reading 'create')
at new m.<computed> (web-comp-1.js:3:2706)
at new t (web-comp-1.js:3:12616)

When I checked the line, the code is,当我检查线路时,代码是,

(o = (u = F && 1 === a.create.length)? Reflect.construct

Generated web component using below versions and angular elements: "@angular/animations": "14.2.7", "@angular/cdk": "14.2.5", "@angular/common": "14.2.7", "@angular/compiler": "14.2.7", "@angular/core": "14.2.7", "@angular/elements": "14.2.7",使用以下版本和 angular 元素生成 web 组件: "@angular/animations": "14.2.7", "@angular/cdk": "14.2.5", "@angular/common": "14.2.7", " @angular/compiler": "14.2.7", "@angular/core": "14.2.7", "@angular/elements": "14.2.7",

Stackblitz link:https://stackblitz.com/edit/web-platform-bkqbag?file=index.html Stackblitz 链接:https://stackblitz.com/edit/web-platform-bkqbag?file=index.html

If you run in stack blitz, you wont see any error, you need to download the project and open in only "Chrome".如果你在 stack blitz 中运行,你不会看到任何错误,你需要下载项目并只在“Chrome”中打开。 This issue happening only in chrome, not in mozilla此问题仅在 chrome 中发生,在 mozilla 中不发生

在此处输入图像描述

Upgraded document-register-element package from 1.7.2 to 1.14.10 in package json, the error gone away.在 package json 中将 document-register-element package 从 1.7.2 升级到 1.14.10,错误消失了。 Thank you @Abolfazl Almas, your link triggered me an idea谢谢@Abolfazl Almas,你的链接让我想到了一个主意

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法读取 angular 中未定义(读取“页面”)的属性 - Cannot read properties of undefined (reading 'page') in angular 在 Angular 中加载页面时出现“无法读取未定义的属性(读取‘id’)”错误 - "Cannot read properties of undefined (reading 'id')" error when loading page in Angular Angular:: ERROR TypeError:无法读取未定义的属性(正在读取“电子邮件”) - Angular:: ERROR TypeError: Cannot read properties of undefined (reading 'email') 错误:无法读取未定义的属性(读取“管道”)Angular12 - Error: Cannot read properties of undefined (reading 'pipe') Angular12 Angular 错误类型错误:无法读取未定义的属性(读取“onDestroy”) - Angular ERROR TypeError: Cannot read properties of undefined (reading 'onDestroy') 错误类型错误:无法读取未定义的属性(读取“imageUrl”)Angular 材料 - ERROR TypeError: Cannot read properties of undefined (reading 'imageUrl') Angular material Angular 12:错误类型错误:无法读取未定义的属性(读取“nativeElement”) - Angular 12: ERROR TypeError: Cannot read properties of undefined (reading 'nativeElement') Angular 错误无法读取未定义的属性(读取'init') - Angular error cannot read properties of undefined (reading 'init') Angular 显示:错误类型错误:无法读取未定义的属性(读取“状态”) - Angular Showing: ERROR TypeError: Cannot read properties of undefined (reading 'State') ERROR TypeError: Cannot read properties of undefined (reading 'message') in Angular Login - ERROR TypeError: Cannot read properties of undefined (reading 'message') in Angular Login
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM