Skip to content

Commit

Permalink
fix: check value correspond to selected value
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Bijaoui committed Sep 27, 2016
1 parent 7106394 commit b00e777
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/fields/fieldRadios.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="jade">
.radio-list(:disabled="disabled")
label(v-for="item in items")
input(type="radio", :disabled="disabled", :name="id", @click="onSelection(item)", :value="getItemValue(item)")
input(type="radio", :disabled="disabled", :name="id", @click="onSelection(item)", :value="getItemValue(item)", :checked="isItemChecked(item)" )
| {{ getItemName(item) }}

</template>
Expand Down Expand Up @@ -48,7 +48,16 @@
}
return item;
}
},
isItemChecked(item) {
let currentValue;
if (isObject(item) && this.schema.radiosOptions.value && item[this.schema.radiosOptions.value]){
currentValue = item[this.schema.radiosOptions.value];
} else{
currentValue = item;
}
return (currentValue === this.value);
},
}
};
</script>
Expand Down

0 comments on commit b00e777

Please sign in to comment.