fix: add radioGroup mouse event & radio name inherit radioGroup name
parent
6a7dacf9a2
commit
00f2054783
|
@ -63,6 +63,12 @@ export default {
|
||||||
this.$emit('input', targetValue)
|
this.$emit('input', targetValue)
|
||||||
this.$emit('change', event)
|
this.$emit('change', event)
|
||||||
},
|
},
|
||||||
|
onMouseEnter (e) {
|
||||||
|
this.$emit('mouseenter', e)
|
||||||
|
},
|
||||||
|
onMouseLeave (e) {
|
||||||
|
this.$emit('mouseleave', e)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value (val) {
|
value (val) {
|
||||||
|
@ -70,9 +76,16 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render () {
|
render () {
|
||||||
const { radioOptions, classes, $slots, name } = this
|
const { radioOptions, classes, $slots, name,
|
||||||
|
onMouseEnter,
|
||||||
|
onMouseLeave,
|
||||||
|
} = this
|
||||||
return (
|
return (
|
||||||
<div class={classes}>
|
<div
|
||||||
|
class={classes}
|
||||||
|
onMouseenter={onMouseEnter}
|
||||||
|
onMouseleave={onMouseLeave}
|
||||||
|
>
|
||||||
{radioOptions.map(({ value, disabled, label }) =>
|
{radioOptions.map(({ value, disabled, label }) =>
|
||||||
<Radio key={value} value={value} disabled={disabled} name={name}>{label}</Radio>)}
|
<Radio key={value} value={value} disabled={disabled} name={name}>{label}</Radio>)}
|
||||||
{ radioOptions.length === 0 && ($slots.default || []).filter(c => c.tag || c.text.trim() !== '')}
|
{ radioOptions.length === 0 && ($slots.default || []).filter(c => c.tag || c.text.trim() !== '')}
|
||||||
|
|
|
@ -114,13 +114,19 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render () {
|
render () {
|
||||||
const { id, classes, checkboxClass, disabled, prefixCls,
|
const { id, classes, checkboxClass, prefixCls,
|
||||||
stateChecked, handleChange, name, $slots,
|
stateChecked, handleChange, $slots,
|
||||||
onFocus,
|
onFocus,
|
||||||
onBlur,
|
onBlur,
|
||||||
onMouseEnter,
|
onMouseEnter,
|
||||||
onMouseLeave,
|
onMouseLeave,
|
||||||
|
radioGroupContext,
|
||||||
} = this
|
} = this
|
||||||
|
let { name, disabled } = this
|
||||||
|
if (radioGroupContext) {
|
||||||
|
name = radioGroupContext.name
|
||||||
|
disabled = disabled || radioGroupContext.disabled
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<label
|
<label
|
||||||
class={classes}
|
class={classes}
|
||||||
|
|
Loading…
Reference in New Issue