我在 darts web ui 介绍页面上读到了这篇文章。
The constructor attribute indicates the class that defines this component’s behavior (for example, “CounterComponent”). Today, this class must be a subclass of WebComponent, but in the future it will be possible to use a subclass of the HTML element declared in the extends attribute. In the preceding example, that would mean class CounterComponent extends DivElement ....
他们是否说过何时安排此更改以及是否需要重写扩展 WebComponent 的旧组件?
最佳答案
我不知道何时/是否会发生这种情况,但 WebComponent 类具有以下注释:
/**
* Temporary property until components extend [Element]. An element can
* only be associated with one host, and it is an error to use a web component
* without an associated host element.
*/
Element get host { ... }
因为它说“临时”,我想如果您的代码明确引用主机
,则需要进行一些更改。
关于dart web ui webcomponents 将来扩展 html 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16721882/