vue+element作用域插槽
作用域插槽的样式由父组件决定,内容却由子组件控制。
在el-table使用作用域插槽
<el-table>
<el-table-column
slot-scope=" { row, column, $index }">
</el-table-column>
</el-table>
在el-tree使用作用域插槽
<el-tree>
<span class="custom-tree-node" slot-scope="{ node, data }">
</el-tree>
<el-table style="width: 100%" border :data="list">
<el-table-column type="index" label="序号" width="80px" align="center">
</el-table-column>
<el-table-column prop="tmName" label="品牌名称" width="width">
</el-table-column>
<el-table-column prop="logoUrl" label="品牌LOGO" width="width">
<template slot-scope="{ row, $index }">
<img :src="row.logoUrl" alt="" style="width: 100px; height: 100px" />
</template>
</el-table-column>
<el-table-column prop="prop" label="操作" width="width">
<template slot-scope="{ row, $index }">
<el-button
type="warning"
icon="el-icon-edit"
size="mini"
@click="updateTradeMark(row)"
>修改</el-button
>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
@click="deleteTradeMark(row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
原文地址:https://blog.csdn.net/weixin_62980497/article/details/137893012
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!