当前位置:网站首页>Usage of the formatter attribute of El table
Usage of the formatter attribute of El table
2022-07-26 09:51:00 【Zhou Xiaotiao】
One 、formatter What is it? ?
formatter yes el-table-column A property of , Used to format content .( For example, the backstage returns 0 or 1, You need to show it as “ no ” and “ yes ”)
Two 、 Detailed use
1. know formatter Before :
The code is as follows ( Example ):
<el-table :data="tabledata">
<el-table-column label=" type " prop="type">
<template slot-scope="scope">
<span>
<span v-if="scope.row.type === '1'"> menu </span>
<span v-else-if="scope.row.type === '2'"> Button </span>
<span v-else> other </span>
</span>
</template>
</el-table-column>
</el-table>
2. know formatter after , The above code can be rewritten as :
html in :
<el-table :data="tabledata">
<el-table-column label=" type " :formatter="typeFormatter" prop="type"></el-table-column>
</el-table>
methods in :
// Normalized type There are four parameters by default (row, column, cellValue, index) Details can be found at elmentUI Official website
typeFormatter(row){
switch(row.type){
case '1':
return ' menu '
case '2':
return ' Button '
default:
return ' other '
}
}
summary
Blogging is for taking notes !
边栏推荐
- Sublime install plug-ins
- RMQ学习笔记
- Flutter event distribution
- 服务器、客户端双认证
- Azkaban [basic knowledge 01] core concepts + features +web interface + Architecture +job type (you can get started with Azkaban workflow scheduling system in one article)
- 图解用户登录验证流程,写得太好了!
- Fuzzy PID control of motor speed
- Show default image when wechat applet image cannot be displayed
- spolicy请求案例
- 在Blazor 中自定义权限验证
猜你喜欢
MySQL的逻辑架构
Sqoop【环境搭建 01】CentOS Linux release 7.5 安装配置 sqoop-1.4.7 解决警告并验证(附Sqoop1+Sqoop2最新版安装包+MySQL驱动包资源)
PMM (percona monitoring and management) installation record
阿里云技术专家郝晨栋:云上可观测能力——问题的发现与定位实践
CSV data file settings of JMeter configuration components
小白搞一波深拷贝 浅拷贝
2019 ICPC Asia Yinchuan regional (water problem solution)
【Datawhale】【机器学习】糖尿病遗传风险检测挑战赛
高斯消元
spolicy请求案例
随机推荐
JS 连等赋值操作
SSG框架Gatsby访问数据库,并显示到页面上
(1) Hand eye calibration of face scanner and manipulator (eye on hand)
IIS website configuration
Apple dominates, Samsung revives, and domestic mobile phones fail in the high-end market
高斯消元
MySQL的逻辑架构
What is the principle of reflection mechanism?
JS判断数据类型 Object.prototype.toString.call和typeof
新公链Aptos何以拉满市场期待值?
Sqoop [environment setup 01] CentOS Linux release 7.5 installation configuration sqoop-1.4.7 resolve warnings and verify (attach sqoop 1 + sqoop 2 Latest installation package +mysql driver package res
2022 zhongkepan cloud - server internal information acquisition and analysis flag
编写一个在bash / shell 和 PowerShell中均可运行的脚本
js 表格自动循环滚动,鼠标移入暂停
PHP one-time request lifecycle
反射机制的原理是什么?
Node memory overflow and V8 garbage collection mechanism
新增市场竞争激烈,中国移动被迫推出限制性超低价5G套餐
spolicy请求案例
高斯消元求解矩阵的逆(gauss)