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>
相关推荐
谎言西西里3 小时前
JS 高手必会:手写 new 与 instanceof
javascript
雪碧聊技术4 小时前
前端项目代码发生改变,如何重新部署到linux服务器?
前端·vue3·centos7·代码更新,重新部署
liulilittle4 小时前
C++ 浮点数封装。
linux·服务器·开发语言·前端·网络·数据库·c++
wordbaby4 小时前
Expo 进阶指南:赋予 TanStack Query “原生感知力” —— 深度解析 AppState 与 NetInfo
前端·react native
Moment5 小时前
从美团全栈化看 AI 冲击:前端转全栈,是自救还是必然 🤔🤔🤔
前端·后端·面试
天问一5 小时前
使用 Vue Router 进行路由定制和调用的示例
前端·javascript·vue.js
源码获取_wx:Fegn08956 小时前
基于springboot + vue心理健康管理系统
vue.js·spring boot·后端
韩立学长6 小时前
【开题答辩实录分享】以《基于Vue的非遗文化知识分享平台的设计与实现》为例进行选题答辩实录分享
前端·javascript·vue.js
优弧6 小时前
离开舒适区100天,我后悔了吗?
前端·后端·面试
胡gh6 小时前
css的臂膀,前端动效的利器,还是布局的“隐形陷阱”?
前端·css·html