
ant design vue中的折叠面板collapse嵌套radio group异常问题
使用ant design vue构建的页面中, a-collapse 内部的 a-radio-group 会被识别为子面板,导致结构异常,无法正常展开。
解决方案:
为了避免此问题,可在 a-radio-group 外层添加一个 div 进行包裹,如下所示:
将静态 Vue 页面(index.vue)改造为动态页面(Custom.vue);稿源仅限 index.vue、其引用的 CSS 与资源路径,禁止参考仓库内其他文件。Invoke when user wants to transform a static Vue page into a dynamic data-driven page with Element UI components.
立即学习“前端免费学习笔记(深入)”;
<template>
<div>
<a-collapse prefix-cls="s-accordion" :default-active-key="activeKey">
<a-collapse-panel key="introduction" header="introduction">
<p>introduction</p>
</a-collapse-panel>
<div> <!-- 外层div包裹radio-group -->
<a-radio-group v-model:value="tab" style="margin: 16px">
<a-radio-button value="tab1">tab1</a-radio-button>
<a-radio-button value="tab2">tab2</a-radio-button>
</a-radio-group>
</div>
</a-collapse>
</div>
</template>通过添加外层 div,a-radio-group 将被正确识别,不会作为子面板,从而解决结构异常的问题。

















