当前位置:网站首页>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 !
边栏推荐
猜你喜欢
Solve proxyerror: CONDA cannot proceed due to an error in your proxy configuration
图解用户登录验证流程,写得太好了!
Uni app learning summary
I finished watching this video on my knees at station B
2021年山东省中职组“网络空间安全”B模块windows渗透(解析)
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
Node memory overflow and V8 garbage collection mechanism
Principle analysis and source code interpretation of service discovery
面试突击68:为什么 TCP 需要 3 次握手?
A new paradigm of distributed deep learning programming: Global tensor
随机推荐
Apple dominates, Samsung revives, and domestic mobile phones fail in the high-end market
莫队学习总结(二)
服务器内存故障预测居然可以这样做!
【荧光字效果】
POJ 1012 Joseph
开发转测试:从0开始的6年自动化之路...
莫队学习笔记(一)
What is the principle of reflection mechanism?
(2) Hand eye calibration of face scanner and manipulator (eye out of hand: nine point calibration)
[datawhale] [machine learning] Diabetes genetic risk detection challenge
Flutter Event 派发
Malloc failed to allocate space and did not return null
Docker configuring MySQL Cluster
regular expression
服务器环境配置全过程
JS continuous assignment operation
spolicy请求案例
POJ 1012 Joseph
MySQL的逻辑架构
Cloud native (36) | introduction and installation of harbor in kubernetes