当前位置:网站首页>下拉框数据字典应用案例
下拉框数据字典应用案例
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")
})
}
边栏推荐
猜你喜欢
随机推荐
js实现一个 bind 函数
-钞票兑换-
浅谈函数递归汉诺塔
Junit
-完全数-
MySQL 唯一索引 UNIQUE KEY 会导致死锁?
【函数与递归】7.19
Ali cloud object storage oss private barrels to generate links
1060 爱丁顿数 (25 分)
一劳永逸解决vs编译器无法使用scanf函数
Kaggle(四)Scikit-learn
【Flask】Flask-SQLAlchemy的增删改查(CRUD)操作
【转】最小描述长度准则MDL(Minimun Description Length)
Power button 561. An array of split
1069 微博转发抽奖 (20 分)(C语言)
Lambda表达式案例
Djiango第二次培训
初识C语言
1054 求平均值 (20 分)
【myPow,2次幂,3次幂..代码实现】