Skip to content

Commit dcd8ba0

Browse files
author
Damian Dulisz
committed
1 parent 0a49f90 commit dcd8ba0

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

docs/partials/examples/MultiSelect.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ div
88
:close-on-select="false",
99
:clear-on-select="false",
1010
:hide-selected="true",
11+
:preserve-search="true",
1112
placeholder="Pick some"
1213
label="name",
1314
track-by="name"
1415
)
16+
template(slot="tag", scope="props")
17+
span.custom__tag
18+
span {{ props.option.language }}
19+
span.custom__remove(@click="props.remove(props.option)")
1520
pre.language-json
1621
code.
1722
{{ value }}
@@ -43,5 +48,13 @@ export default {
4348
}
4449
</script>
4550

46-
<style lang="css">
51+
<style lang="sass">
52+
.custom__tag
53+
display: inline-block
54+
padding: 2px 6px
55+
background: #ddd
56+
margin-right: 4px
57+
58+
.custom__remove
59+
padding: 3px
4760
</style>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@
9393
"sinon": "^1.17.3",
9494
"sinon-chai": "^2.8.0",
9595
"url-loader": "^0.5.7",
96-
"vue": "2.1.10",
96+
"vue": "^2.3.0",
9797
"vue-hot-reload-api": "^1.2.0",
9898
"vue-html-loader": "^1.0.0",
9999
"vue-loader": "^11.0.0",
100100
"vue-style-loader": "^2.0.0",
101-
"vue-template-compiler": "2.1.10",
101+
"vue-template-compiler": "^2.3.4",
102102
"vue-template-es2015-compiler": "^1.4.2",
103103
"vuex": "^2.1.1",
104104
"webpack": "^2.2.1",

src/multiselectMixin.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ export default {
265265
default () {
266266
return []
267267
}
268+
},
269+
preserveSearch: {
270+
type: Boolean,
271+
default: false
268272
}
269273
},
270274
mounted () {
@@ -527,7 +531,7 @@ export default {
527531
this.isOpen = true
528532
/* istanbul ignore else */
529533
if (this.searchable) {
530-
this.search = ''
534+
if (!this.preserveSearch) this.search = ''
531535
this.$nextTick(() => this.$refs.search.focus())
532536
} else {
533537
this.$el.focus()
@@ -549,7 +553,7 @@ export default {
549553
} else {
550554
this.$el.blur()
551555
}
552-
this.search = ''
556+
if (!this.preserveSearch) this.search = ''
553557
this.$emit('close', this.getValue(), this.id)
554558
},
555559
/**

0 commit comments

Comments
 (0)