checkbox label click event

This commit is contained in:
cookfront 2017-03-08 17:30:55 +08:00
parent 99bf210b62
commit 7278df2f00

View File

@ -6,6 +6,7 @@
}"> }">
<span class="zan-checkbox__input"> <span class="zan-checkbox__input">
<input <input
ref="input"
v-model="currentValue" v-model="currentValue"
type="checkbox" type="checkbox"
class="zan-checkbox__control" class="zan-checkbox__control"
@ -16,7 +17,7 @@
}"> }">
</span> </span>
</span> </span>
<span class="zan-checkbox__label"> <span class="zan-checkbox__label" @click="handleLabelClick">
<slot></slot> <slot></slot>
</span> </span>
</div> </div>
@ -92,6 +93,15 @@ export default {
? this.parentGroup.disabled || this.disabled ? this.parentGroup.disabled || this.disabled
: this.disabled; : this.disabled;
} }
},
methods: {
handleLabelClick() {
if (this.isDisabled) {
return;
}
this.$refs.input.click();
}
} }
}; };
</script> </script>