vue3在使用Element-plus 2.X时,出现el-popover或el-popconfirm中button不展示问题。
正常效果:
第一种错误原因:el-button没有添加 slot='reference'
<template slot-scope="scope">
<el-popconfirm title="您确定删除吗?" @onConfirm="cancelOrder(scope.row.id)">
<el-button >删除</el-button>
</el-popconfirm>
</template>
第二种错误方式: 添加 slot='reference' 还是不展示,没想到吧!!!!!2.3.9官网就是这么写的啊
<el-popover
placement="top"
width="200"
v-model="scope.row.visible">
<p>确定删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button type="text" @click="scope.row.visible= false">取消</el-button>
<el-button type="text" @click="delete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference">删除</el-button>
</el-popover>
正确方式:
<el-popover
placement="top"
width="200"
v-model="scope.row.visible">
<p>确定删除吗?</p>
<div style="text-align: right; margin: 0">
<el-button type="text" @click="scope.row.visible= false">取消</el-button>
<el-button type="text" @click="delete(scope.row.id)">确定</el-button>
</div>
<template #reference>
<el-button >删除</el-button>
</template>
</el-popover>