子组件代码
<el-table-column prop="more-operation" label="操作">
<slot name="operation" :file_info="item.row">
</slot>
</el-table-column>
父组件代码
<template
slot="operation"
slot-scope="scope"
>
<el-popover
slot="operation"
placement="bottom"
trigger="hover">
<div class="menu-item" @click="onRenameClick(scope)"><i class="el-icon-edit-outline"></i> 重命名</div>
<div class="menu-item"><i class="el-icon-star-on"></i> 收藏</div>
<div class="menu-item"><i class="el-icon-download"></i> 下载</div>
<i class="el-icon-more" slot="reference"></i>
</el-popover>
</template>
onRenameClick 打印的scope结果
开发遇到的记录一下,示例应是一个嵌套插槽,稍作修改
|