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>
相关推荐
会一点设计8 小时前
6个优质春节海报模板网站推荐!轻松设计马年祝福海报
ui·ux
hudawei99618 小时前
TweenAnimationBuilder和AnimatedBuilder两种动画的比较
flutter·ui·动画·tweenanimation·animatedbuilder
依米阳光0819 小时前
Playwright MCP AI实现自动化UI测试
ui·自动化·playwright·mcp
芷栀夏1 天前
CANN 仓库实战:用 DrissionPage 构建高效、稳定的 UI 自动化测试框架
ui·aigc·transformer·cann
微祎_1 天前
构建一个 Flutter 点击速度测试器:深入解析实时交互、性能度量与响应式 UI 设计
flutter·ui·交互
AAA阿giao1 天前
从零拆解一个 React + TypeScript 的 TodoList:模块化、数据流与工程实践
前端·react.js·ui·typescript·前端框架
晚霞的不甘1 天前
Flutter for OpenHarmony 构建简洁高效的待办事项应用 实战解析
flutter·ui·前端框架·交互·鸿蒙
百思可瑞教育1 天前
构建自己的Vue UI组件库:从设计到发布
前端·javascript·vue.js·ui·百思可瑞教育·北京百思教育
XPii2 天前
Photoshop应用——将图片变为水墨画效果
ui·photoshop
AC梦2 天前
unity中如何将UI上的字高清显示
ui·unity