[new feature]Checkbox: support disabled label (#644)

This commit is contained in:
ddchef
2018-02-26 14:22:29 +08:00
committed by neverland
parent 0132e855cf
commit d7403a0241
3 changed files with 21 additions and 3 deletions

View File

@@ -10,7 +10,7 @@
]"
@click="onClick"
/>
<span class="van-checkbox__label" @click="onClick">
<span class="van-checkbox__label" @click="onClick('label')">
<slot />
</span>
</div>
@@ -28,6 +28,10 @@ export default create({
props: {
value: {},
disabled: Boolean,
labelDisabled: {
type: Boolean,
default: false
},
name: [String, Number],
shape: {
type: String,
@@ -96,8 +100,8 @@ export default create({
},
methods: {
onClick() {
if (!this.isDisabled) {
onClick(flag) {
if (!this.isDisabled && (flag !== 'label' || (flag === 'label' && !this.labelDisabled))) {
this.currentValue = !this.currentValue;
}
}