为什么使用自定义元素时会出现内部Dartium异常? [英] Why do I get an Internal Dartium Exception when using custom elements?
本文介绍了为什么使用自定义元素时会出现内部Dartium异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在控制台中看到此错误:
I am seeing this error in my console:
Exception: InvalidStateError: Internal Dartium Exception
PolymerDeclaration.registerType (package:polymer/src/declaration.dart:241:22)
PolymerDeclaration.register (package:polymer/src/declaration.dart:175:17)
PolymerDeclaration._register (package:polymer/src/declaration.dart:114:13)
PolymerDeclaration.registerWhenReady (package:polymer/src/declaration.dart:109:14)
_notifyType (package:polymer/src/declaration.dart:514:49)
Polymer.register (package:polymer/src/instance.dart:64:16)
_loadLibrary (package:polymer/src/loader.dart:177:25)
我有这样的代码:
@CustomTag('person-tag')
class PersonTag extends PolymerElement {
我的HTML是这样的:
And my HTML is like this:
<polymer-element name="person-tag" extends="li">
为什么我得到 Internal Dartium Exception
registerType
推荐答案
extends =li
,但Dart代码仅扩展 PolymerElement
。
You are seeing this error because your HTML says extends="li"
but the Dart code only extends PolymerElement
.
如果你在 polymer-element
中使用 extends
属性,那么你的Dart类也必须扩展
If you use an extends
attribute in your polymer-element
, then your Dart class must also extend the same kind of element.
要解决问题中的问题,请更改Dart类:
To fix the problem in the question, change the Dart class:
@CustomTag('person-tag')
class PersonTag extends LIElement with Polymer, Observable {
现在 PersonTag
真的扩展< li>
。
这篇关于为什么使用自定义元素时会出现内部Dartium异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文