问题:

使用element-ui中的el-table 表格单选el-radio-group组件报错

Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.
Element with focus: input
Ancestor with aria-hidden:  <input type=​"radio" aria-hidden=​"true" tabindex=​"-1" class=​"el-radio__original" value=​"11574">​

 table部分
<el-table
    :data="tableData"
>
    // 添加单选column
    <el-table-column label="选择" width="50" align="center">
        <template scope="scope">
          <el-radio class="radio"  v-model="radio"  :label="scope.row.id">
              // 这里目的是为了实现单选
              <span>&nbsp;</span>
          </el-radio>
       </template>
    </el-table-column>
</el-table>

data:{
	tableData: [],
	radio: null,
},
解决方法:在style中添加代码
<style lang="scss" scoped>
/deep/ .el-radio__original {
  display: none !important;
}

/deep/ .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled)
  .el-radio__inner {
  box-shadow: none !important;
}
</style>

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐