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>
html 复制代码
<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>
相关推荐
掘金安东尼7 小时前
纯 CSS 实现弹性文字效果
前端·css
牛奶7 小时前
Vue 基础理论 & API 使用
前端·vue.js·面试
牛奶7 小时前
Vue 底层原理 & 新特性
前端·vue.js·面试
anOnion7 小时前
构建无障碍组件之Radio group pattern
前端·html·交互设计
pe7er8 小时前
状态提升:前端开发中的状态管理的设计思想
前端·vue.js·react.js
SoaringHeart9 小时前
Flutter调试组件:打印任意组件尺寸位置信息 NRenderBox
前端·flutter
晚风予星9 小时前
Ant Design Token Lens 迎来了全面升级!支持在 .tsx 或 .ts 文件中直接使用 Design Token
前端·react.js·visual studio code
sunny_9 小时前
⚡️ vite-plugin-oxc:从 Babel 到 Oxc,我为 Vite 写了一个高性能编译插件
前端·webpack·架构
GIS之路9 小时前
ArcPy 开发环境搭建
前端
林小帅11 小时前
【笔记】OpenClaw 架构浅析
前端·agent