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>
相关推荐
dotent·8 小时前
C#基于WPF UI框架的通用基础上位机测试WPF框架
ui·c#·wpf
安卓理事人16 小时前
安卓多种通知ui更新的方式(livedata,rxjava,eventbus等)
android·ui·echarts
半兽先生1 天前
uniapp高性能ui框架uni-ui
ui·uni-app
马剑威(威哥爱编程)1 天前
鸿蒙6开发中,UI相关应用崩溃常见问题与解决方案
ui·华为·harmonyos
ITVV2 天前
元数据 Unity Catalog v0.3.0 UI
ui·元数据
袅沫2 天前
Element-UI 番外表格组件
javascript·vue.js·ui
百锦再3 天前
[特殊字符] HBuilder uni-app UI 组件库全方位对比
android·java·开发语言·ui·rust·uni-app·go
lqj_本人4 天前
鸿蒙与Qt的双线程模型:主线程与UI线程的博弈
qt·ui·harmonyos
南华4 天前
Visual Studio 2022 加载解决方案缓慢
ui
lqj_本人5 天前
鸿蒙原生与Qt混合开发:UI集成与事件处理
qt·ui·harmonyos