Browse Source

upd:nut-switch增加传参label,适用循环场景时,onchange事件指定label

zjyau 5 years ago
parent
commit
da4cb8812f
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/packages/switch/switch.vue

+ 6 - 1
src/packages/switch/switch.vue

@@ -22,6 +22,11 @@ export default {
     disabled: {
       type: Boolean,
       default: false
+    },
+    label:
+    {
+      type: String,
+      default: ""
     }
   },
   data() {
@@ -47,7 +52,7 @@ export default {
       }
       this.isAnimating = true;
       setTimeout(() => {
-        this.$emit("change", this.isActive);
+        this.$emit("change", this.isActive, this.label);
         this.$emit("update:active", this.isActive);
         this.isAnimating = false;
       }, 300);