17 lines
600 B
JavaScript
17 lines
600 B
JavaScript
![]() |
import { Component, triggerEvent, getValueFromProps } from '../../_util/simply';
|
||
|
import { RadioGroupDefaultProps } from './props';
|
||
|
import mixinValue from '../../mixins/value';
|
||
|
Component(RadioGroupDefaultProps, {
|
||
|
onChange: function (_, e) {
|
||
|
var event;
|
||
|
event = e;
|
||
|
var index = event.currentTarget.dataset.index;
|
||
|
var options = getValueFromProps(this, 'options');
|
||
|
var value = options[index].value;
|
||
|
if (!this.isControlled()) {
|
||
|
this.update(value);
|
||
|
}
|
||
|
triggerEvent(this, 'change', value, event);
|
||
|
},
|
||
|
}, null, [mixinValue()]);
|