let not selectable-list know about getKey prop

This commit is contained in:
taehoon 2019-04-04 00:22:55 -04:00
parent 32035217b8
commit b8ec13c8fd
3 changed files with 7 additions and 8 deletions

View file

@ -13,10 +13,9 @@ const SelectableList = {
}
},
methods: {
toggle (checked, item) {
const oldChecked = this.isSelected(item)
toggle (checked, key) {
const oldChecked = this.isSelected(key)
if (checked !== oldChecked) {
const key = this.getKey(item)
if (checked) {
this.selected.push(key)
} else {
@ -24,8 +23,8 @@ const SelectableList = {
}
}
},
isSelected (item) {
return this.selected.indexOf(this.getKey(item)) !== -1
isSelected (key) {
return this.selected.indexOf(key) !== -1
}
}
}