当前位置:网站首页>下拉框数据字典应用案例
下拉框数据字典应用案例
2022-08-03 05:11:00 【肉馅团子】
插件:elemenu-ui中的el-select/el-option
以图内饰为例
代码展示
v-for----------对insideColorList列表数据动态渲染遍历
步入正题:
在data数据中对insideColorList进行定义
insideColorList: cacheDataKeyString("INSIDE_COLOR"),
- 在script中引入
import {cacheDataKeyString, cacheDateName} from '@/assets/js/utils';
在页面表格展示的时候
- 在自定义组件上定义:dropCol
- 在data数据中定义prop进行传递数据
- 在methods中调用数据字典方法
setStatusShow(status, dictionary) { return ( "<span>" +cacheDateName(dictionary, status) + "</span>" ); },
- 在页面加载表格数据的方法中拿到item的insideColorText其中为item.insideColor和 "INSIDE_COLOR",为setStatusShow的传递的参数
apiVehicle.getVehicleList(data).then(res => {
let num1 = 0, num2 = 0;
let list = res.data.data.list;
if (list && list.length > 0) {
list.forEach(item => {
num1 += Number(item.price);
num2 += Number(item.grossWeight);
item.insideColorText = this.setStatusShow(item.insideColor, "INSIDE_COLOR")
item.outsideColorText = this.setStatusShow(item.outsideColor, "OUTSIDE_COLOR")
item.specificationsText = this.setStatusShow(item.specifications, "SPECIFICATIONS")
})
}
边栏推荐
- 【数组排序】+日常
- Installation of Apache DolphinScheduler version 2.0.5 distributed cluster
- Odps temporary query can write SQL, turned out to a named?
- web安全-PHP反序列化漏洞
- D-PHY
- 1069 微博转发抽奖 (20 分)(C语言)
- 用C语言来实现五子棋小游戏
- 对角矩阵(diagonal matrix)
- 13.
lt.647. Palindromic substring + lt.516. Longest palindrome subsequence - 小码农的第一篇博客
猜你喜欢
二叉树的合并[C]
Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
1230: 蜂巢
【特征选取】计算数据点曲率
2.ROS通信机制
uni-app 滚动到顶部/指定位置
web安全-PHP反序列化漏洞
breed Web刷机升级详细教材修正编译器固件说明_itkeji.top
13.
lt.647. Palindromic substring + lt.516. Longest palindrome subsequence MySQL 唯一索引 UNIQUE KEY 会导致死锁?
随机推荐
Build your own web page on raspberry pie (1)
High availability, two locations and three centers
飞机大战完整版
1060 爱丁顿数 (25 分)
快速上手 Mockito 单元测试框架
MySQL 索引检索原理和B+Tree数据结构详解
C语言简单实现扫雷小游戏
业务表解析-余额系统
Newifi路由器第三方固件玩机教程,这个路由比你想的更强大以及智能_Newifi y1刷机_smzdm
vim命令
Js学习笔记(四)
Presto installation and deployment tutorial
如何不耍流氓的做运维之-SHELL脚本
web安全-sql注入漏洞
Installation of Apache DolphinScheduler version 2.0.5 distributed cluster
4.如何避免缓存穿透、缓存击穿、缓存雪崩
celery工作原理图
C语言简单实现三子棋小游戏
详解Nurbs曲线
ss-4.2 多个eureka集群案例