[bugfix] Radio: icon not clickable (#505)

This commit is contained in:
neverland 2018-01-03 19:52:17 +08:00 committed by GitHub
parent 69faabb539
commit 0ab473a273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -1,8 +1,9 @@
<template> <template>
<div <div
@click="handleRadioClick"
class="van-radio" class="van-radio"
:class="{ 'van-radio--disabled': isDisabled }"> :class="{ 'van-radio--disabled': isDisabled }"
@click="$emit('click')"
>
<span class="van-radio__input"> <span class="van-radio__input">
<input <input
:value="name" :value="name"
@ -13,7 +14,7 @@
> >
<icon :name="currentValue === name ? 'checked' : 'check'" /> <icon :name="currentValue === name ? 'checked' : 'check'" />
</span> </span>
<span class="van-radio__label" @click="handleLabelClick"> <span class="van-radio__label" @click="onClickLabel">
<slot /> <slot />
</span> </span>
</div> </div>
@ -63,15 +64,11 @@ export default create({
}, },
methods: { methods: {
handleLabelClick() { onClickLabel() {
if (this.isDisabled) { if (this.isDisabled) {
return; return;
} }
this.currentValue = this.name; this.currentValue = this.name;
},
handleRadioClick() {
this.$emit('click');
} }
} }
}); });

View File

@ -33,6 +33,7 @@ $van-radio-size: 20px;
} }
.van-icon { .van-icon {
pointer-events: none;
font-size: $van-radio-size; font-size: $van-radio-size;
} }