提交 56317489 编写于 作者: H hdx

fix(enum-data组件): 逻辑错误导致界面显示异常

上级 e4feec19
...@@ -22,11 +22,10 @@ ...@@ -22,11 +22,10 @@
// @ts-ignore // @ts-ignore
_change(e : RadioGroupChangeEvent) { _change(e : RadioGroupChangeEvent) {
const selected = this.items.find((item : ItemType) : boolean => { const selected = this.items.find((item : ItemType) : boolean => {
return item.name == e.detail.value return item.value.toString() == e.detail.value
}) })
if (selected != null) { if (selected != null) {
this.current = selected.value this.$emit('change', selected.value)
this.$emit('change', this.current)
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '当前选中:' + selected.name, title: '当前选中:' + selected.name,
...@@ -46,7 +45,7 @@ ...@@ -46,7 +45,7 @@
<view class="uni-list uni-common-pl"> <view class="uni-list uni-common-pl">
<radio-group @change="_change"> <radio-group @change="_change">
<radio class="uni-list-cell uni-list-cell-pd radio" v-for="(item, index) in items" :key="item.name" <radio class="uni-list-cell uni-list-cell-pd radio" v-for="(item, index) in items" :key="item.name"
:class="index < items.length - 1 ? 'uni-list-cell-line' : ''" :value="item.name" :checked="index === current"> :class="index < items.length - 1 ? 'uni-list-cell-line' : ''" :value="item.value">
{{ item.name }} {{ item.name }}
</radio> </radio>
</radio-group> </radio-group>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册