gamebrary/src/components/PlatformToggleField.vue

44 lines
892 B
Vue
Raw Normal View History

2021-01-08 21:31:44 +00:00
<template lang="html">
<b-form-checkbox-group
v-model="selectedPlatforms"
:options="options"
switches
stacked
@input="$emit('change', selectedPlatforms)"
/>
</template>
<script>
import { mapState, mapGetters } from 'vuex';
export default {
data() {
return {
selectedPlatforms: null,
};
},
computed: {
...mapState(['board']),
...mapGetters(['platformNames']),
options() {
return this.board.platforms.map((value) => {
2021-01-08 23:09:15 +00:00
const text = this.platformNames[value] && this.platformNames[value].name
? `${this.platformNames[value].name}`
: `N/A Missing label for platform ${value}`;
2021-01-08 21:31:44 +00:00
return { text, value };
});
},
},
mounted() {
this.selectedPlatforms = JSON.parse(JSON.stringify(this.board.platforms));
},
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
</style>