1

我正在进入 Polymer,我喜欢使用导入的 deps 解析方法。
而且我喜欢通过behaviors配置扩展功能。
然而,有些事情让我感觉不舒服,特别是关于行为。
查看PolymerElements代码,我看到行为是在全局对象中自己的 html 中定义的Polymer,然后在由另一个组件导入时直接引用。
例如:

paper-button进口paper-button-behavior https://github.com/PolymerElements/paper-button/blob/master/paper-button.html#L14

然后它定义为来自全局https://github.com/PolymerElements/paper-button/blob/master/paper-button.html#L144paper-button-behavior的行为引用Polymer.PaperButtonBehavior

这里定义了(导入的html) https://github.com/PolymerElements/paper-behaviors/blob/master/paper-button-behavior.html#L49

这难道不是一种反模式,尤其是应用程序通常不会专门使用 Polymer 的世界吗?

4

0 回答 0