Jeecg Boot 2.2.1 版本发布,低代码平台

This commit is contained in:
zhangdaiscott
2020-07-11 12:54:57 +08:00
parent cb7ae9ca6f
commit 109a95a96b
191 changed files with 28087 additions and 26880 deletions

View File

@ -1,5 +1,12 @@
<template>
<a-switch v-model="checkStatus" :disabled="disabled" @change="handleChange"/>
<div>
<a-select v-if="query" style="width: 100%" @change="handleSelectChange">
<a-select-option v-for="(item, index) in queryOption" :key="index" :value="item.value">
{{ item.text }}
</a-select-option>
</a-select>
<a-switch v-else v-model="checkStatus" :disabled="disabled" @change="handleChange"/>
</div>
</template>
<script>
@ -7,7 +14,7 @@
name: 'JSwitch',
props: {
value:{
type: String,
type: String | Number,
required: false
},
disabled:{
@ -19,6 +26,11 @@
type:Array,
required:false,
default:()=>['Y','N']
},
query:{
type: Boolean,
required: false,
default: false
}
},
data () {
@ -30,23 +42,37 @@
value:{
immediate: true,
handler(val){
if(!val){
this.checkStatus = false
this.$emit('change', this.options[1]);
}else{
if(this.options[0]==val){
this.checkStatus = true
}else{
if(!this.query){
if(!val){
this.checkStatus = false
this.$emit('change', this.options[1]);
}else{
if(this.options[0]==val){
this.checkStatus = true
}else{
this.checkStatus = false
}
}
}
}
}
},
computed:{
queryOption(){
let arr = []
arr.push({value:this.options[0],text:'是'})
arr.push({value:this.options[1],text:'否'})
return arr;
}
},
methods: {
handleChange(checked){
let flag = checked===false?this.options[1]:this.options[0];
this.$emit('change', flag);
},
handleSelectChange(value){
this.$emit('change', value);
}
},
model: {