簡體   English   中英

鐵列表多選將項目多次添加到選擇中

[英]iron-list multi-selection adds items multiple times to selection

我有一個啟用multi-selection iron-list ,我的問題是,單擊時沒有將選擇的[[children]]元素添加到{{selectedChildren}} ,而不是在單擊時選擇/取消選擇了項目。

<iron-list items="[[children]]" selected-items="{{selectedChildren}}" selection-enabled multi-selection>
    <template>
        <div class$="[[iconForItem(selected, item)]]">
            <iron-image class="avatar" sizing="contain" src="[[item.pic]]"></iron-image>
            <div class="pad">
                <div class="primary" th:inline="none">[[item.name]]</div>
                <div class="secondary dim" th:inline="none">[[item.bdate]]</div>
                <div><paper-textarea value="{{item.comment}}" on-tap="noFoc"></paper-textarea></div>
            </div>
        </div>
    </template>
</iron-list>

這里可能是什么問題?

問題是:

properties: {
    selectedChildren: {
        type: Array, // bad idea
        value: []    // bad idea
    }
}

它應該是:

properties: {
    selectedChildren: {
        type: Object // This works
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM