当前位置:网站首页>下拉框数据字典应用案例
下拉框数据字典应用案例
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")
})
}
边栏推荐
- The problem that the rosbag tool plotjuggler cannot open rosbag
- C语言简单实现扫雷小游戏
- 建造者模式(Builder Pattern)
- junit总结
- js实现一个 bind 函数
- Odps temporary query can write SQL, turned out to a named?
- 初识C语言
- 7.7(5)
- Install IIS services (Internet Information Services (Internet Information Services, abbreviated IIS, Internet Information Services)
- Makefile语法
猜你喜欢
随机推荐
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)
13.
lt.647. Palindromic substring + lt.516. Longest palindrome subsequence 三角形个数
-寻找鞍点-
-最高分-
1089 狼人杀-简单版 (20 分)
高效率科研神器——小软件、大能量
flask 面试题 问题
Js学习笔记(四)
背压机制
Djiango第三次培训
MySQL 索引详解和什么时候创建索引什么时候不适用索引
Ali cloud object storage oss private barrels to generate links
Junit
7.8(6)
Pr第四次培训笔记
第四次培训
Pr第二次培训笔记
Kaggle 入门(Kaggle网站使用及项目复现)
ss-4.2 多个eureka集群案例