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>

 

相关推荐

  1. vue2 实战:作用

    2024-04-21 07:56:03       43 阅读
  2. vue3中作用

    2024-04-21 07:56:03       32 阅读
  3. 具名/匿名/作用区分

    2024-04-21 07:56:03       26 阅读
  4. vue组件render函数中作用使用方式

    2024-04-21 07:56:03       30 阅读
  5. 作用(词法作用

    2024-04-21 07:56:03       38 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-21 07:56:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-21 07:56:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-21 07:56:03       82 阅读
  4. Python语言-面向对象

    2024-04-21 07:56:03       91 阅读

热门阅读

  1. Git 将一个项目同时推送到多个远程仓库

    2024-04-21 07:56:03       109 阅读
  2. 使用策略模式实现 Spring 分布式和单机限流

    2024-04-21 07:56:03       33 阅读
  3. 笔记wife_assistant

    2024-04-21 07:56:03       25 阅读
  4. 23种设计模式之结构型模式篇

    2024-04-21 07:56:03       27 阅读
  5. linux命令ar使用说明

    2024-04-21 07:56:03       125 阅读
  6. core_v4.2

    core_v4.2

    2024-04-21 07:56:03      122 阅读
  7. 深入Git配置

    2024-04-21 07:56:03       71 阅读
  8. rk3568 ubuntu修改IP地址

    2024-04-21 07:56:03       35 阅读