Skip to content

Commit

Permalink
fix: dropdown clearing of value (#975)
Browse files Browse the repository at this point in the history
Co-authored-by: Lee Chase <lee.chase@uk.ibm.com>
  • Loading branch information
lee-chase and lee-chase authored Jul 30, 2020
1 parent c0bf478 commit bc17f76
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/core/src/components/cv-dropdown/cv-dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
v-if="label"
:id="`${uid}-label`"
:class="[`${carbonPrefix}--label`, { [`${carbonPrefix}--label--disabled`]: disabled }]"
>{{ label }}</span
>
{{ label }}
</span>

<div
data-dropdown
Expand Down Expand Up @@ -219,16 +218,22 @@ export default {
methods: {
updateChildren(val) {
const childItems = this.dropdownItems();
let foundSelection = false;
for (let index in childItems) {
let child = childItems[index];
let selected = child.value === val;
child.internalSelected = selected;
if (selected) {
foundSelection = true;
this.selectedChild = child;
}
}
if (!foundSelection) {
this.selectedChild = null;
}
},
checkSlots() {
// NOTE: this.$slots is not reactive so needs to be managed on beforeUpdate
Expand Down

0 comments on commit bc17f76

Please sign in to comment.