简体   繁体   English

Dart库与聚合物相互导入

[英]Dart library mutual import with polymer

I have a polymer element containing another one. 我有一个包含另一种的聚合物元素。 I tried to have them in the same library like the following 我试图将它们放在如下的同一个库中

In parent.dart 在parent.dart中

library Parent; 图书馆家长;

part "child.dart"; 部分“ child.dart”;

In child.dart 在child.dart中

part of Parent 父母的一部分

But this doesn't work. 但这是行不通的。 I guess because the child.dart is also included in child.html (the polymer template file.) So I separated them into two libraries and have they like 我猜是因为child.dart也包含在child.html(聚合物模板文件)中。所以我将它们分成两个库,它们是否喜欢

In parent.dart 在parent.dart中

library Parent; 图书馆家长;

import "child.dart"; 导入“ child.dart”;

In child.dart 在child.dart中

library Child; 儿童图书馆;

import "parent.dart"; 导入“ parent.dart”;

This works but I'm not sure this is the correct way to do it. 这可行,但是我不确定这是正确的方法。 Any ideas? 有任何想法吗?

Thanks, Yi 谢谢,易

为每个自定义元素提供自己的库是一种新兴的最佳实践。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM