「上單擊」刪除在聚合物達特做一個自定義按鈕組件:我如何從一個自定義的聚合物組分
<div id="buttonDiv">
<my-button id="traceButton"
mode="icon" faicon="fa-comment-o"
toolTip="Print a simple comment"
disabled="false" on-click="{{ traceSomething }}">
</my-button>
</div>
我試圖複製/粘貼此按鈕別處。所以用戶定義了它,我基本上通過獲取$['buttonDiv'].children
然後將其插入其他地方來移動它。問題是{{ traceSomething }}
現在不相關,因爲它不是新父項的一部分。我得到的錯誤表明,父對象,這是另一個聚合物組件沒有實例getter「traceSomething」。
我的問題是,有沒有辦法刪除「traceSomething」,然後再將其插入其他地方?我嘗試刪除「onClick」事件偵聽器,但按鈕仍然希望在單擊時調用該功能。此外,我試着添加一個preventDefault等,如:In Dart, if I listen to a click event with two listeners, how do I know which happens first? 但是,沒有運氣。
嗯,在我的情況,我想從一個div的子元素,而「移動「他們在其他地方.... 喜歡: 列表 origen = $ ['buttonDiv']。children; // Then origen.forEach((c)=> $ ['newHome']。children.add(c)); –