mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-04-16 18:38:11 +00:00
54 lines
1.0 KiB
Java
54 lines
1.0 KiB
Java
<template>
|
|
<a-checkbox-group :options="options" :value="checkboxArray" @change="onChange" />
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'JCheckbox',
|
|
props: {
|
|
value:{
|
|
type: String,
|
|
required: false
|
|
},
|
|
readOnly:{
|
|
type: Boolean,
|
|
required: false,
|
|
default: false
|
|
},
|
|
/*label value*/
|
|
options:{
|
|
type: Array,
|
|
required: true
|
|
},
|
|
triggerChange:{
|
|
type: Boolean,
|
|
required: false,
|
|
default: false
|
|
}
|
|
},
|
|
data(){
|
|
return {
|
|
checkboxArray:!this.value?[]:this.value.split(",")
|
|
}
|
|
},
|
|
watch:{
|
|
value (val) {
|
|
if(!val){
|
|
this.checkboxArray = []
|
|
}else{
|
|
this.checkboxArray = this.value.split(",")
|
|
}
|
|
}
|
|
},
|
|
methods:{
|
|
onChange (checkedValues) {
|
|
if(this.triggerChange){
|
|
this.$emit('change', checkedValues.join(","));
|
|
}else{
|
|
this.$emit('input', checkedValues.join(","));
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|