Skip to content

Commit f8f7780

Browse files
committed
Merge pull request yuche#166 from Lunkr/master
selected item's label should be shown in button content
2 parents 56d93bf + bc23214 commit f8f7780

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Select.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,18 @@ import coerceBoolean from './utils/coerceBoolean.js'
9595
selectedItems() {
9696
let foundItems = []
9797
if (this.value.length) {
98-
for (let item in this.value) {
99-
if (typeof this.value[item] === "string") {
100-
foundItems.push(this.value[item])
98+
this.value.forEach(item => {
99+
if (typeof item === "string") {
100+
let option
101+
this.options.some(o => {
102+
if(o.value === item) {
103+
option = o
104+
return true
105+
}
106+
})
107+
option && foundItems.push(option.label)
101108
}
102-
}
109+
})
103110
return foundItems.join(', ')
104111
}
105112
},

0 commit comments

Comments
 (0)