当前位置:网站首页>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 !
边栏推荐
- Interview shock 68: why does TCP need three handshakes?
- copyTo
- 服务器环境配置全过程
- Fiddler packet capturing tool for mobile packet capturing
- regular expression
- 2021年山东省中职组“网络空间安全”B模块windows渗透(解析)
- 高斯消元的应用
- What is the principle of reflection mechanism?
- Spolicy request case
- Azkaban【基础知识 01】核心概念+特点+Web界面+架构+Job类型(一篇即可入门Azkaban工作流调度系统)
猜你喜欢

MySQL的逻辑架构

A new paradigm of distributed deep learning programming: Global tensor

挡不住了,纯国产PC已就位,美国的软硬件体系垄断正式被破

服务器内存故障预测居然可以这样做!

Apple dominates, Samsung revives, and domestic mobile phones fail in the high-end market

PMM (percona monitoring and management) installation record

Applet record

开发转测试:从0开始的6年自动化之路...

【Datawhale】【机器学习】糖尿病遗传风险检测挑战赛

面试突击68:为什么 TCP 需要 3 次握手?
随机推荐
2022 zhongkepan cloud - server internal information acquisition and analysis flag
2021年山东省中职组“网络空间安全”B模块windows渗透(解析)
PHP one-time request lifecycle
The combination of officially issued SSL certificate and self signed certificate realizes website two-way authentication
开发转测试:从0开始的6年自动化之路...
The problem of accessing certsrv after configuring ADCs
Tableviewcell highly adaptive
js 表格自动循环滚动,鼠标移入暂停
Azkaban [basic knowledge 01] core concepts + features +web interface + Architecture +job type (you can get started with Azkaban workflow scheduling system in one article)
Matlab Simulink realizes fuzzy PID control of time-delay temperature control system of central air conditioning
The whole process of server environment configuration
Cloud native (36) | introduction and installation of harbor in kubernetes
Login module use case writing
Alibaba cloud technology expert haochendong: cloud observability - problem discovery and positioning practice
Redis sentinel mode setup under Windows
(1) Hand eye calibration of face scanner and manipulator (eye on hand)
MQTT X CLI 正式发布:强大易用的 MQTT 5.0 命令行工具
编写一个在bash / shell 和 PowerShell中均可运行的脚本
Sqoop【付诸实践 02】Sqoop1最新版 全库导入 + 数据过滤 + 字段类型支持 说明及举例代码(query参数及字段类型强制转换)
RMQ学习笔记