diff --git a/dev/Dev.vue b/dev/Dev.vue
index d180b1a..d384b5e 100644
--- a/dev/Dev.vue
+++ b/dev/Dev.vue
@@ -1,8 +1,19 @@
-
-
-
+
+
+
+
+
+
+
+
options: {{ options }}
+
selected: {{ selected }}
@@ -14,6 +25,32 @@ import Sandbox from '../docs/.vuepress/components/Sandbox';
export default {
components: {Sandbox, vSelect},
+ data: () => ({
+ selected: 1,
+ options: [
+ {
+ ContactID: 1,
+ Firstname: 'John',
+ Lastname: 'Connor',
+ summary_short: 'John Connor
* 28. February 1985
Los Angeles',
+ summary_text: 'John Connor, Los Angeles, 28. Februar 1985',
+ },
+ {
+ ContactID: 2,
+ Firstname: 'Sarah',
+ Lastname: 'Connor',
+ summary_short: 'Sarah Connor
* 1965
Los Angeles',
+ summary_text: 'Sarah Connor, Los Angeles, 1965',
+ },
+ {
+ ContactID: 3,
+ Firstname: 'Kyle',
+ Lastname: 'Reese (Connor)',
+ summary_short: 'Kyle Reese
* 2002
Los Angeles',
+ summary_text: 'Kyle Reese, Los Angeles, 2002',
+ },
+ ],
+ }),
};
@@ -27,6 +64,8 @@ export default {
#app {
height: 100%;
+ width: 50%;
+ margin: 5rem auto;
}
hr {
diff --git a/docs/.vuepress/components/Sandbox.vue b/docs/.vuepress/components/Sandbox.vue
index 7e7126c..c2171e1 100644
--- a/docs/.vuepress/components/Sandbox.vue
+++ b/docs/.vuepress/components/Sandbox.vue
@@ -118,7 +118,8 @@
-
+
{{ label }}
@@ -129,11 +130,13 @@
-
+
-
{{ option.title }}
@@ -204,6 +207,9 @@ export default {
};
},
methods: {
+ swap () {
+ this.configuration.options = [];
+ },
search (search, loading) {
loading(true);
this.getRepositories(search, loading, this);
@@ -241,8 +247,7 @@ export default {
display: grid;
grid-template-columns: auto 75%;
grid-template-rows: auto;
- grid-template-areas:
- "sidebar component"
+ grid-template-areas: "sidebar component"
}
#config {
diff --git a/src/components/Select.vue b/src/components/Select.vue
index a80efdd..ebcef8e 100644
--- a/src/components/Select.vue
+++ b/src/components/Select.vue
@@ -472,14 +472,13 @@
* when options change.
* Make sure selected option
* is correct.
- * @return {[type]} [description]
*/
options(val) {
if (!this.taggable && this.resetOnOptionsChange) {
this.clearSelection()
}
- if (this.value && this.isTrackingValues) {
+ if (this.resetOnOptionsChange && this.isTrackingValues) {
this.setInternalValueFromOptions(this.value)
}
},
diff --git a/tests/unit/ReactiveOptions.spec.js b/tests/unit/ReactiveOptions.spec.js
index 04b6a91..803fa83 100755
--- a/tests/unit/ReactiveOptions.spec.js
+++ b/tests/unit/ReactiveOptions.spec.js
@@ -26,7 +26,7 @@ describe("Reset on options change", () => {
it("should return correct selected value when the options property changes and a new option matches", () => {
const Select = shallowMount(VueSelect, {
- propsData: { value: "one", options: [], reduce(option) { return option.value } }
+ propsData: { value: "one", options: [], reduce: option => option.value }
});
Select.setProps({options: [{ label: "oneLabel", value: "one" }]});