1. 在使用element plus表格操作按钮,使用v-if,作用元素,
出现如下报错:ElementPlusError: [ElOnlyChild] no valid child node found
代码如下:
<el-table-column label="操作" align="center" fixed="right" width="150" class-name="small-padding fixed-width" v-hasPermi="['project:manage:edit', 'project:manage:undertake', 'project:manage:query', 'project:manage:remove']"> <template #default="scope"> <el-tooltip content="删除" placement="top"> <el-button link type="danger" icon="delete" v-if="scope.row.status === '0' && auth.hasPermi('project:manage:remove')" @click="handleDelete(scope.row)"></el-button> </el-tooltip> </template> </el-table-column>
2. 解决方法:
将v-if作用2在el-tooltip上即可,而不是作用在按钮上。
<el-table-column label="操作" align="center" fixed="right" width="150" class-name="small-padding fixed-width" v-hasPermi="['project:manage:edit', 'project:manage:undertake', 'project:manage:query', 'project:manage:remove']"> <template #default="scope"> <el-tooltip content="删除" placement="top" v-if="scope.row.status === '0' && auth.hasPermi('project:manage:remove')"> <el-button link type="danger" icon="delete" v-if="scope.row.status === '0' && auth.hasPermi('project:manage:remove')" @click="handleDelete(scope.row)"></el-button> </el-tooltip> </template> </el-table-column>
标签:node,ElOnlyChild,no,ElementPlusError,valid,child From: https://www.cnblogs.com/shyhuahua/p/18332452