[英]Polymer.dart propertyNameChanged method in a custom library isn't working
這是我的polymer.dart類。
import 'package:polymer/polymer.dart';
/**
* A Polymer x-changer element.
*/
@CustomTag('x-changer')
class XChanger extends PolymerElement {
@published String prop;
propChanged() {
print("prop changed!");
}
/// Constructor used to create instance of XChanger.
XChanger.created() : super.created() {
}
}
這是我的項目結構:
當我在示例文件夾中添加x-changer.dart和x-changer.html時,它可以工作。 這是完全相同的代碼,我是否缺少對聚合物元素庫很重要的東西?
編輯:這是庫pubspec
name: some_elements
description: >
The polymer elements for ...
version: 0.0.1
author: Joris Hermans
#homepage: https://www.example.com
dependencies:
polymer: '>=0.15.4 <0.16.0'
dev_dependencies:
unittest: any
您需要在庫中添加聚合物變壓器(沒有entry_points)。
您不應You shouldn't import like
` You shouldn't import like
它看起來應該更像
您不應該像<link rel="import" href="packages/chat_example/force/force_client_element.html">
您可能需要一個或多個其他../
前綴,具體取決於導入文件所在的位置(在Dart包:xxx導入中這從來沒有必要。
<link rel="import" href="../packages/chat_example/force/force_client_element.html">
有關更多詳細信息,請參見https://www.dartlang.org/polymer/app-directories.html 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.