当前位置:网站首页>el-table gets the data attribute of a row in the read data table
el-table gets the data attribute of a row in the read data table
2022-08-03 07:02:00 【m0_67391121】
el-table gets the data attribute of a row in the read data table, and changes the display method of processing a column of data
This article records the method of obtaining a row of data in the data table
1Click a row to get the data
Use @row-click and row
Write this method in the methods of js
test(row){console.log('clicked');console.log(row);console.log(row.title);}
The effect of the front-end inspection is as follows:
2 Change a column of data, process a column of data and display it again
For example, when you need to convert 0, 1, and 2 in the database that represent male, female, and other genders into Chinese characters in the table.Or make a column of data clickable, and so on.
Use scope.row.xxx to get the properties of this column of this row.
The code below is to make the id of the job clickable
{{scope.row.title}}
The following is to make the student's name clickable and change the gender from numbers to Chinese characters
{{scope.row.name}} {{sexChange(scope.row.sex)}}
Methods defined in js
//Gender character conversionsexChange(sex){if(sex==0){return 'male';}else if(sex==1){return 'female';}else {return 'other';}},
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
猜你喜欢
随机推荐
JUC并发编程深入浅出!
【YOLOv3 SPP 数据集准备】YOLOv3 SPP数据集准备代码理解
【设计指南】避免PCB板翘,合格的工程师都会这样设计!
【nohup】nohup命令的简单使用
Chrome插件开发入门
sql优化常用的几种方法
TFS(Azure DevOps)禁止多人同时签出
mysql的配置文件(my.ini或者 my.cnf)所在位置
process.env环境变量配置方式(配置环境变量区分开发环境和生产环境)
2021-06-14
2021-06-15
MySql的安装配置超详细教程与简单的建库建表方法
Oracle数据文件收缩_最佳实践_超简单方法
Multi-Head-Attention原理及代码实现
Cesium加载离线地图和离线地形
UniApp 自定义条件编译详细使用流程
【Personal summary】Key points of MES system development/management
Podman can learn in one piece
WinServer2012r2破解多用户同时远程登录,并取消用户控制
如何使用md5码验证文件的一致性