-
Notifications
You must be signed in to change notification settings - Fork 9
/
u-checkboxs.vue
40 lines (37 loc) · 938 Bytes
/
u-checkboxs.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
<template>
<div class="u-checkboxs">
<u-checkbox
v-for="(item, index) in list"
:key="index"
:label="item[labelField]"
:checked.sync="item[checkedField]"
:disabled="disabled || item[disabledField]"
@change="checkboxChanged"
/>
</div>
</template>
<script>
export default {
name: 'u-checkboxs',
props: {
list: { type: Array, default: () => [] },
labelField: { type: String, default: 'label' },
checkedField: { type: String, default: 'checked' },
disabledField: { type: String, default: 'disabled' },
disabled: { type: Boolean, default: false }
},
methods: {
checkboxChanged() {
this.$emit('change', this.list)
}
}
}
</script>
<style lang="scss" scoped>
.u-checkboxs {
display: inline-block;
.u-checkbox {
padding: 0 5px;
}
}
</style>