|
@@ -15,8 +15,11 @@
|
|
|
|
|
|
|
|
module.exports = {
|
|
module.exports = {
|
|
|
name: 'Switches',
|
|
name: 'Switches',
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
props: [
|
|
props: [
|
|
|
- "selected", // 选择状态, false
|
|
|
|
|
|
|
+ "modelValue", // 选择状态, false
|
|
|
"disabled", // 禁用, false
|
|
"disabled", // 禁用, false
|
|
|
"showText", // 是否显示文字提示
|
|
"showText", // 是否显示文字提示
|
|
|
"textTrueIn", // True状态下的文字
|
|
"textTrueIn", // True状态下的文字
|
|
@@ -25,12 +28,14 @@ module.exports = {
|
|
|
"type-bold", // 大图标
|
|
"type-bold", // 大图标
|
|
|
],
|
|
],
|
|
|
|
|
|
|
|
|
|
+ emits: ['update:modelValue'],
|
|
|
|
|
+
|
|
|
data: function(){
|
|
data: function(){
|
|
|
var tempValue = false;
|
|
var tempValue = false;
|
|
|
var colors = 'red';
|
|
var colors = 'red';
|
|
|
- if(this.selected != undefined){
|
|
|
|
|
- tempValue = (this.selected == 'true' || this.selected == true);
|
|
|
|
|
- if(this.selected == 'true' || this.selected == true){
|
|
|
|
|
|
|
+ if(this.modelValue != undefined){
|
|
|
|
|
+ tempValue = (this.modelValue == 'true' || this.modelValue == true);
|
|
|
|
|
+ if(this.modelValue == 'true' || this.modelValue == true){
|
|
|
colors = 'green';
|
|
colors = 'green';
|
|
|
}else{
|
|
}else{
|
|
|
colors = 'red';
|
|
colors = 'red';
|
|
@@ -57,10 +62,10 @@ module.exports = {
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
value: function(val, oldVal) {
|
|
value: function(val, oldVal) {
|
|
|
- this.$emit('input', val);
|
|
|
|
|
|
|
+ this.$emit('update:modelValue', val);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- selected: function(val, oldVal) {
|
|
|
|
|
|
|
+ modelValue: function(val, oldVal) {
|
|
|
if(val != undefined){
|
|
if(val != undefined){
|
|
|
this.value = (val == 'true' || val == true);
|
|
this.value = (val == 'true' || val == true);
|
|
|
if(val == 'true' || val == true){
|
|
if(val == 'true' || val == true){
|