当前位置:网站首页>下拉框数据字典应用案例
下拉框数据字典应用案例
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")
})
}
边栏推荐
猜你喜欢
随机推荐
web安全-PHP反序列化漏洞
-完全数-
1.ROS环境搭建与基础工作
Response 重写设置返回值
C语言简单实现三子棋小游戏
0.ROS常用命令
初识C语言
二叉树的合并[C]
集合框架知识
Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
7.18(7)
业务表解析-余额系统
【myPow,2次幂,3次幂..代码实现】
celery工作原理图
ss-4.1-1个eurekaServer+1个providerPayment+1个consumerOrder
breed Web刷机升级详细教材修正编译器固件说明_itkeji.top
junit总结
三角形个数
《录取通知》 观后感
Navicat 解决隔一段时间不操作出现延时卡顿问题