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

View File

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