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>
相关推荐
输出输入2 小时前
前端核心技术
开发语言·前端
Mintopia2 小时前
Web 安全与反编译源码下的权限设计:构建前后端一体的信任防线
前端·安全·编译原理
林深现海2 小时前
Jetson Orin nano/nx刷机后无法打开chrome/firefox浏览器
前端·chrome·firefox
EchoEcho3 小时前
深入理解 Vue.js 渲染机制:从声明式到虚拟 DOM 的完整实现
vue.js
黄诂多3 小时前
APP原生与H5互调Bridge技术原理及基础使用
前端
前端市界3 小时前
用 React 手搓一个 3D 翻页书籍组件,呼吸海浪式翻页,交互体验带感!
前端·架构·github
文艺理科生3 小时前
Nginx 路径映射深度解析:从本地开发到生产交付的底层哲学
前端·后端·架构
千寻girling3 小时前
主管:”人家 Node 框架都用 Nest.js 了 , 你怎么还在用 Express ?“
前端·后端·面试
C澒3 小时前
Vue 项目渐进式迁移 React:组件库接入与跨框架协同技术方案
前端·vue.js·react.js·架构·系统架构
xiaoxue..3 小时前
合并两个升序链表 与 合并k个升序链表
java·javascript·数据结构·链表·面试