forked from area17/twill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckboxAccordion.vue
executable file
·61 lines (59 loc) · 1.49 KB
/
CheckboxAccordion.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<template>
<a17-accordion :open="open" @toggleVisibility="notifyOpen">
<span slot="accordion__title"><slot></slot></span>
<div slot="accordion__value">{{ currentLabel }}</div>
<a17-checkboxgroup :name="name" :options="options" @change="changeValue" :selected="currentValue" :min="1"></a17-checkboxgroup>
</a17-accordion>
</template>
<script>
import a17Accordion from './Accordion.vue'
import VisibilityMixin from '@/mixins/toggleVisibility'
import { LANGUAGE } from '@/store/mutations'
export default {
name: 'A17Checkboxaccordion',
components: {
'a17-accordion': a17Accordion
},
mixins: [VisibilityMixin],
props: {
value: {
default: function () { return [] }
},
title: {
type: String,
default: ''
},
name: {
type: String,
default: ''
},
options: {
default: function () { return [] }
}
},
data: function () {
return {
currentValue: this.value
}
},
watch: {
value: function (newValue) {
this.currentValue = newValue
}
},
computed: {
currentLabel: function () {
return this.currentValue.length + ' Live'
}
},
methods: {
changeValue: function (newValue) {
this.currentValue = newValue
this.$store.commit(LANGUAGE.PUBLISH_LANG, newValue)
},
notifyOpen: function (newValue) {
this.$emit('open', newValue, this.$options.name)
}
}
}
</script>