Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/Radio/RadioGroup/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
style="{{ style }}">
<radio-group
name="{{ name }}"
value="{{ mixin.value }}">
value="{{ mixin.value }}"
onChange="onChange">
<view class="ant-radio-group-body">
<block a:if="{{ position === 'vertical' }}">
<block
Expand All @@ -18,11 +19,10 @@
<list-item>
<radio
checked="{{ componentUtils.getChecked(index, options, mixin.value) }}"
data-index="{{ index }}"
value="{{ item.value }}"
disabled="{{ disabled || item.disabled }}"
color="{{ item.color || color }}"
onChange="onChange">
>
<!-- #if ALIPAY -->
<slot
name="label"
Expand All @@ -47,11 +47,10 @@
a:key="value">
<radio
checked="{{ componentUtils.getChecked(index, options, mixin.value) }}"
data-index="{{ index }}"
value="{{ item.value }}"
disabled="{{ disabled || item.disabled }}"
color="{{ item.color || color }}"
onChange="onChange">
>
<!-- #if ALIPAY -->
<slot
name="label"
Expand Down
17 changes: 4 additions & 13 deletions src/Radio/RadioGroup/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
import mixinValue from '../../mixins/value';
import { Component, getValueFromProps, triggerEvent } from '../../_util/simply';
import { Component, triggerEvent } from '../../_util/simply';
import { RadioGroupDefaultProps } from './props';

Component({
props: RadioGroupDefaultProps,
methods: {
onChange(_, e) {
let event;
/// #if ALIPAY
event = e;
/// #endif
/// #if WECHAT
event = _;
/// #endif
const index = event.currentTarget.dataset.index;
const options = getValueFromProps(this, 'options');
const value = options[index].value;
onChange(e) {
const value = e.detail.value;
if (!this.isControlled()) {
this.update(value);
}
triggerEvent(this, 'change', value, event);
triggerEvent(this, 'change', value, e);
},
},
mixins: [mixinValue()],
Expand Down