ElementPlusError: [ElOnlyChild] no valid child node found

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>

 

posted @ 2024-07-30 15:05  行走的蒲公英  阅读(382)  评论(0编辑  收藏  举报