我有一个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>
这可能是什么问题?
答案 0 :(得分:1)
问题是:
properties: {
selectedChildren: {
type: Array, // bad idea
value: [] // bad idea
}
}
应该是:
properties: {
selectedChildren: {
type: Object // This works
}
}