在Dart中,我一直在努力創造一種延伸的聚合物元素。如何在Dart聚合物中延伸
@CustomTag('deckname-td-item')
class DecknameTdItemElement extends TableCellElement with Polymer, Observable {
@published String item;
DecknameTdItemElement.created() : super.created();
void wordFileClicked(Event e, var detail, Node target) {
String deckName = $['deckAnchor'].text;
dispatchEvent(new CustomEvent('decknameclicked', detail: deckName));
}
}
對應的HTML:
<polymer-element name="deckname-td-item" extends="td">
<template>
<style>
a {
font-weight: bold;
}
</style>
<a id='deckAnchor' href="#" on-click="{{wordFileClicked}}">{{item}}</a>
</template>
<script type="application/dart" src="deckname_td_item.dart"></script>
</polymer-element>
用法:
<td is="deckname-td-item" item="{{wordFile}}"
on-decknameclicked="{{deckNameChanged1}}"></td>
一切都在Dartium工作正常,它編譯沒有任何警告,但是當我運行生成的輸出,我得到:
Uncaught Unsupported operation: extendsTag does not match base native class
什麼我在這裏做錯了嗎?
還沒有解答?也許在這個論壇發佈信息:https://groups.google.com/a/dartlang.org/forum/#!forum/web –