最近使用了Element-UI中的Table表格,因为需求需要在指定的列点击跳转,所以必须添加个点击事件,我这里是弹框展示table再点击跳转的,如图所示:

下面是我实现具体的代码(只是代码的一部分,我删减出来的)

<template>
<el-dialog custom-class="m-dialog-addAminMsg" title="列表" width="940px" :visible.sync="caseListDialog" :close-on-click-modal="false" :show-close="false">
<div class="m-search" align='right' style="margin-bottom:10px">
<el-input placeholder="请输入关键字" style="width: 270px;margin-right:10px" v-model="searchAh" size="small"></el-input>
<el-button type="primary" @click="searchCaseListAh" size="small">搜索</el-button>
</div>
<el-table
:data="caseData"
:row-style="$store.getters.tableRowStyle"
:header-cell-style="{background:'#eef1f6',color:'#606266'}"
highlight-current-row
height="256"
style="width: 100%"
@current-change="handleCurrentChange"
>
<!-- 最重要的代码开始 -->
<el-table-column prop="ah" label="货号" min-width="230" align='left'>
<template slot-scope="scope">
<a @click="cancelDialog(scope.row)" style="color:blue;cursor:pointer">{{scope.row.hh}}</a>
</template>
</el-table-column>
<!-- 最重要的代码结束 -->
<el-table-column prop="zh" label="账号" min-width="230" align='left'></el-table-column>
<el-table-column prop="zy" label="摘要" min-width="150" align='left'></el-table-column>
<el-table-column prop="rq" label="日期" min-width="150" align='left'></el-table-column>
<el-table-column prop="tsrq" label="推送日期" min-width="150" align='left'></el-table-column>
<el-table-column prop="hm" label="户名" min-width="150" align='left'></el-table-column>
</el-table>
<el-pagination @current-change="chageCurrentAHPage" :current-page="currentPage2" :page-size="pageSize2" background layout="total, prev, pager, next" :total="total2" align='right'></el-pagination>
</el-dialog>

</template>
<script>
import {api} from '@/api/'
export default {
name: 'BillingApplication',
data () {
return {
currentPage2: 1, // 当前页
pageSize2: 10, // 每页总条数
total2: 0, // 总条数
caseData: [],//案件列表
caseListDialog: false, //案件选择弹框
choseAHData:{},//选择的案件
searchAh: "",//填写案件搜索
}
},
created () {
},
mounted () {
},
computed: {
},
methods: {

// 确定选择案件
cancelDialog(row) {
this.formTable.hh = row.hh
this.formTable.hhid = row.hhid
this.formTable.hm = row.hm
this.formTable.khrq = row.rq
this.formTable.zh = row.zh
this.formTable.jyzy = row.zy
this.formTable.beizhu = row.beizhu
this.currentPage2 = '1'
this.pageSize2 = '10'
this.searchAh = ''
this.caseListDialog = false;
},

// 新增选货号当前页
chageCurrentAHPage(val) {
this.currentPage2 = val
this.pageAjJbxxZhxx()
},
// 案件查询
pageAjJbxxZhxx () {
let self = this
let ah = ""
let params = {
ah: self.searchAh, // 货号
fszt: '50', // 状态
pageNumber: self.currentPage2,
pageSize: self.pageSize2
}
api.pageAjJbxxZhxx(params).then((res) => {
self.caseData = res.rows
self.total2 = res.total
})
},
},

</script>

<style lang="scss" scoped>
::v-deep .m-dialog-addAminMsg {
.el-dialog__header {
padding: 20px 20px 12px;
border-bottom: 1px solid #EBEEF5;
text-align: left;
.el-dialog__title {
font: normal bold 16px MicrosoftYaHei;
}
}
.el-dialog__body {
max-height: 360px;
overflow: auto;
.el-form-item {
margin-bottom: 10px;
&:last-of-type {
margin-bottom: 0;
.el-form-item__content {
// text-align: right;
font-size: 12px
}
}
}
}
.el-dialog__footer{
border-top: 1px solid #EBEEF5
}
}
</style>
希望能帮到正在学习Element的小伙伴,这也是我成长的知识小积累,欢迎大家一起讨论。

vue--Element-UI Table 表格指定列添加点击事件的更多相关文章

  1. vue+element 表格动态列添加点击事件与排序(/或者空值排最后)

    <template> <div> <el-table     ref="tableData"       :data="tableData& ...

  2. vue + element ui table表格二次封装 常用功能

    因为在做后台管理项目的时候用到了大量的表格, 且功能大多相同,因此封装了一些常用的功能, 方便多次复用. 组件封装代码: <template> <el-table :data=&qu ...

  3. Vue+element ui table 导出到excel

    需求: Vue+element UI table下的根据搜索条件导出当前所有数据 参考: https://blog.csdn.net/u010427666/article/details/792081 ...

  4. vue+element ui 的表格列使用组件

    前言:工作中用到 vue+element ui 的前端框架,有这个场景:很多表格的列有许多一样的,所以考虑将列封装为组件.转载请注明出处:https://www.cnblogs.com/yuxiaol ...

  5. 封装Vue Element的table表格组件

    上周分享了几篇关于React组件封装方面的博文,这周就来分享几篇关于Vue组件封装方面的博文,也好让大家能更好地了解React和Vue在组件封装方面的区别. 在封装Vue组件时,我依旧会交叉使用函数式 ...

  6. vue element UI el-table 表格调整行高的处理方法

    这是我在工作项目中遇到的问题,我想将标记处下方的表格高度调低一点,也就是想实现下面的这个效果: 代码调整如下: 说明: 缩小:行高到一定程度之后便不能缩小. 好像最小35px.各位可以试一下. 升高: ...

  7. vue+element ui table组件封装,使用render渲染

    后台管理经常会用到表格,一开始封装了一个常用的功能性表格,点击这里: 后来由于需求增加,在表格中还会用到switch,select,input等多种组件,每次都要在html中增加<el-tabl ...

  8. element ui table 表格排序

    实现elementui表格的排序 1:给table加上sort-change,给table每一项加上sortable和column-key,排序是根据column-key来进行排序的 <el-t ...

  9. vue element ui table 自动无限滚动组件

    <template>   <el-table     class="tableList"     ref="rw_table"     hei ...

  10. Vue+element UI实现表格数据导出Excel组件

    介绍 这是一个可以将页面中的表格数据导出为Excel文件的功能组件,该组件一般与表格一起使用,将表格数据传给组件,然后通过点击组件按钮可将表格中的数据导出成Excel文件. 使用方法 由于封装该组件内 ...

随机推荐

  1. 前端每日一知之css常用布局单位

    脑图在线链接 本文内容依据[js每日一题]公众号精彩文章总结而来

  2. cv2, pil.image, plt.image 读图的差异

    人是习惯性动物,当我们第一次用opencv时,肯定会觉得opencv的imread()方式很奇怪,做图像出来天天说图像是RGB图RGB图,可opencv读出来的图,却是BGR的顺序.是不是很奇怪,还不 ...

  3. 论文解读《The Philosopher’s Stone: Trojaning Plugins of Large Language Models》

    发表时间:2025 期刊会议:Network and Distributed System Security (NDSS) Symposium 论文单位:Shanghai Jiao Tong Univ ...

  4. 入门 .NET Aspire: 使用 .NET 简化云原生应用开发

    入门 .NET Aspire: 使用 .NET 简化云原生应用开发 https://devblogs.microsoft.com/dotnet/introducing-dotnet-aspire-si ...

  5. JEP 457 Java 22:Class-File API

    查看 Java 22:Class-File API | 作者:Ben Weidig | 2024 年 4 月 | Medium 终于有一个和 DLR 相当的官方库了.

  6. 【C#】【答卷】萌狼蓝天大二上学期期末C#考试复习卷(样题)

  7. 【数据库】【MySQL】创建数据库、数据表、修改数据表字段的一些基本操作

    这是一份作业,仅此而已. 代码仅供参考. # 创建数据库yggl_mllt9920 CREATE DATABASE yggl_mllt9920; # 选择数据库 USE yggl_mllt9920; ...

  8. /etc/rancher/k3s/registries.yaml

    mirrors: "192.168.50.3": endpoint: - "https://192.168.50.3"configs: "192.16 ...

  9. containerd 导入镜像

    containerd 导入镜像 containerd而非docker,需要离线导入镜像 解决原理https://segmentfault.com/a/1190000019534913ctr --nam ...

  10. Spring Security OAuth2 - 自定义 OAuth2.0 令牌发放接口地址

    登录实现拿浏览器网页登录举例: 基于 OAuth2.0-密码模式 实现网页登录的本质就是浏览器通过 /oauth/token 接口将 用户名 和 密码 等信息传给后台, 然后后台验证通过后返回一个有效 ...