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>
相关推荐
界面开发小八哥1 天前
界面控件DevExpress WPF v24.2新版亮点:报表等组件功能升级
ui·.net·wpf·界面控件·devexpress·ui开发
共享ui设计和前端开发1 天前
数字孪生在UI前端的应用:从理论到实践
ui
艾学习1 天前
浅谈为windows7平台打包基于pyside6的UI程序
ui
蓝胖子的多啦A梦1 天前
搭建前端项目 Vue+element UI引入 步骤 (超详细)
前端·vue.js·ui
蔡蓝2 天前
设计模式-状态模式
ui·设计模式·状态模式
sunshine_程序媛2 天前
在Vue2项目中引入ElementUI详细步骤
前端·ui·elementui·前端框架·vue
海上彼尚2 天前
Vue3 PC端 UI组件库我更推荐Naive UI
前端·vue.js·ui
大千AI助手2 天前
5分钟玩转Swagger UI:Docker部署+静态化实战
ui·docker·容器·swagger·swaggerui
EndingCoder2 天前
React Native UI 框架与动画系统:打造专业移动应用界面
react native·react.js·ui
reg1833 天前
包含30个APP移动端网站UI的psd适用于餐厅咖啡店面包店快餐店
ui