-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
el-radio-group中, el-radio-button类型 在选项动态变化后,看不到选中状态 #65
Comments
@YunYouJun 能否帮看一下啊,谢谢 |
你好,我对目前的场景和需要实现的需求有些困惑? 使用 const gradeList = computed(() => xxx) |
@YunYouJun 感谢答复! 并且,目前这个bug出现在了<el-radio-button> ,而<el-radio>符合预期 目前我还没有找到解决办法 |
<template>
<el-row>
<el-col>
<el-radio-group v-model="grade">
<el-radio-button label="">全部</el-radio-button>
<el-radio-button v-for="g in gradeList" :label="g" />
</el-radio-group>
</el-col>
</el-row>
<el-row>
<el-col>
<el-radio-group v-model="subject">
<el-radio label="">全部</el-radio>
<template v-for="s in subjectList">
<el-radio :label="s" />
</template>
</el-radio-group>
</el-col>
</el-row>
grade {{ grade }}
subject {{ subject }}
</template>
<script lang="ts" setup>
import { onMounted, computed, Ref, ref } from 'vue';
const grade = ref('');
const subject = ref('');
const data = ref([
{ "grade": "一年级", "subject": "语文" },
{ "grade": "一年级", "subject": "数学" },
{ "grade": "一年级", "subject": "英语" },
{ "grade": "二年级", "subject": "语文" },
{ "grade": "二年级", "subject": "数学" },
{ "grade": "二年级", "subject": "英语" },
{ "grade": "三年级", "subject": "语文" },
{ "grade": "三年级", "subject": "数学" },
{ "grade": "三年级", "subject": "英语" },
{ "grade": "三年级", "subject": "历史" },
{ "grade": "三年级", "subject": "地理" },
{ "grade": "四年级", "subject": "语文" },
{ "grade": "四年级", "subject": "数学" },
{ "grade": "四年级", "subject": "英语" },
{ "grade": "四年级", "subject": "历史" },
{ "grade": "四年级", "subject": "地理" },
{ "grade": "五年级", "subject": "语文" },
{ "grade": "五年级", "subject": "数学" },
{ "grade": "五年级", "subject": "英语" },
{ "grade": "五年级", "subject": "历史" },
{ "grade": "五年级", "subject": "地理" },
{ "grade": "五年级", "subject": "物理" },
{ "grade": "五年级", "subject": "化学" },
{ "grade": "六年级", "subject": "语文" },
{ "grade": "六年级", "subject": "数学" },
{ "grade": "六年级", "subject": "英语" },
{ "grade": "六年级", "subject": "历史" },
{ "grade": "六年级", "subject": "地理" },
{ "grade": "六年级", "subject": "物理" },
{ "grade": "六年级", "subject": "化学" },
{ "grade": "六年级", "subject": "政治" },
{ "grade": "六年级", "subject": "生物" },
]);
const gradeList = computed(() => {
return new Set(data.value.filter(item => subject.value ? item.subject === subject.value : true)
.map(item => {
return item.grade
}))
})
const subjectList = computed(() => {
return new Set(data.value.filter(item => grade.value ? item.grade === grade.value : true)
.map(item => {
return item.subject
}))
})
</script>
<style>
.el-radio-button.is-active .el-radio-button__inner {
background-color: var(--el-radio-button-checked-bg-color);
}
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
先总结一下问题,目前只发现el-radio-button有问题,el-radio正常。
当el-radio-button的数量动态变化后,is-active的css效果似乎有问题。v-model的数据是正确的。希望尽快修复。
The text was updated successfully, but these errors were encountered: