element-ui和element-plus的自定义列表格用法

element 中的自定义列表格用法

自定义列时只需要声明 slot-scope="scope" 即可。自定义内容需要使用数据时只需要使用 scope.row 即可获取该行数据。

复制代码
<template slot-scope="scope">
  <div class="overPointr2">
    {{scope.row.address}}
  </div>
</template>

element-plus 中的自定义列表格用法

跟 element 差不多,只不过不再是声明 slot-scope="scope",而是按需声明 #default 或者 #default="scope"

1、自定义内容需要使用该行数据时,声明 #default="scope",再通过 scpoe.row 获取数据。

复制代码
<el-table-column
   fixed="right"
    label="操作"
    width="100">
  <template #default="scope">
    <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
    <el-button type="text" size="small">编辑</el-button>
  </template>
</el-table-column>

2、自定义内容需要使用该行数据时,声明 v-slot:default="scope",再通过 scpoe.row 获取数据。

复制代码
  <el-table-column  label="操作" align="center">
     <template v-if="true" v-slot:default="scope">
       <el-button type="primary" size="small" @click="bj"><el-icon><Edit /></el-icon> <span style="margin-left: 3px">编辑</span></el-button>
       <el-button type="danger" size="small" @click="sc(scope.row)"><el-icon><Delete /></el-icon> <span style="margin-left: 3px">删除</span></el-button>
     </template>
    </el-table-column>
相关推荐
小新1109 小时前
vs2022+Qt插件初体验,创建带 UI 界面的 Qt 项目
开发语言·qt·ui
北极糊的狐14 小时前
三星 One UI 8 停止支持 三星Dex后的替代指南
ui
狮智先生14 小时前
【编程实践】Windows + PySide6 + Matplotlib 绘图时 WinError 32 的完整排查与解决方案
windows·ui·个人开发·matplotlib·交通物流
starrycode88814 小时前
【每日一个知识点】Kotlin开发基础知识
ui·kotlin
企微自动化18 小时前
企业微信客户端 UI 自动化定位技术的稳定性和局限性
ui·自动化·企业微信
yoona102018 小时前
Flutter 声明式 UI:为什么 build 会被反复调用?
flutter·ui·区块链·dex
巴拉巴拉~~19 小时前
深入探索Flutter自定义绘制:从零到一实现炫酷仪表盘
flutter·ui
鼎道开发者联盟19 小时前
鼎道AIGUI元件体系如何让DingOS实现“积木”式交互
人工智能·ui·ai·aigc·交互·gui
speedoooo1 天前
在现有App里嵌入一个AI协作者
前端·ui·小程序·前端框架·web app
霍格沃兹测试学院-小舟畅学1 天前
Playwright MCP在UI自动化测试中的定位与思考
ui