From 90634d19b3e845dc30530db15d788dc5cf06bdb4 Mon Sep 17 00:00:00 2001 From: tjz <415800467@qq.com> Date: Sun, 17 Jun 2018 17:22:26 +0800 Subject: [PATCH] fix: add radioGroup mouse event & radio name inherit radioGroup name --- components/radio/Group.jsx | 17 +++++++++++++++-- components/radio/Radio.jsx | 10 ++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/components/radio/Group.jsx b/components/radio/Group.jsx index 822932c59..133b324c1 100644 --- a/components/radio/Group.jsx +++ b/components/radio/Group.jsx @@ -63,6 +63,12 @@ export default { this.$emit('input', targetValue) this.$emit('change', event) }, + onMouseEnter (e) { + this.$emit('mouseenter', e) + }, + onMouseLeave (e) { + this.$emit('mouseleave', e) + }, }, watch: { value (val) { @@ -70,9 +76,16 @@ export default { }, }, render () { - const { radioOptions, classes, $slots, name } = this + const { radioOptions, classes, $slots, name, + onMouseEnter, + onMouseLeave, + } = this return ( -
+
{radioOptions.map(({ value, disabled, label }) => {label})} { radioOptions.length === 0 && ($slots.default || []).filter(c => c.tag || c.text.trim() !== '')} diff --git a/components/radio/Radio.jsx b/components/radio/Radio.jsx index 1108412cd..154fc2ea5 100644 --- a/components/radio/Radio.jsx +++ b/components/radio/Radio.jsx @@ -114,13 +114,19 @@ export default { }, }, render () { - const { id, classes, checkboxClass, disabled, prefixCls, - stateChecked, handleChange, name, $slots, + const { id, classes, checkboxClass, prefixCls, + stateChecked, handleChange, $slots, onFocus, onBlur, onMouseEnter, onMouseLeave, + radioGroupContext, } = this + let { name, disabled } = this + if (radioGroupContext) { + name = radioGroupContext.name + disabled = disabled || radioGroupContext.disabled + } return (