当前位置:网站首页>下拉框数据字典应用案例
下拉框数据字典应用案例
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")
})
}边栏推荐
猜你喜欢
随机推荐
C语言简单实现三子棋小游戏
MySQL 索引详解和什么时候创建索引什么时候不适用索引
Odps temporary query can write SQL, turned out to a named?
The problem that the rosbag tool plotjuggler cannot open rosbag
生活原则。
MySQL 优化建议详解
ModelArts第二次培训
3. 无重复字符的最长子串
1069 微博转发抽奖 (20 分)(C语言)
C-PHY速率
小码农的第一篇博客
Makefile 遍历子目录模板
odps的临时查询能在写sql的时候就给结果一个命名不?
2. 两数相加
判断回文数
ss-4.1-1个eurekaServer+1个providerPayment+1个consumerOrder
Benchmark 第一篇 了解Benchmark
第四次培训
曲线特征----曲线弯曲程度的探究
ss-2.子项目互相访问(order80 -> payment8001)








