if的代码如何优化到最简if(res.OrderInfo.OrderItems.GoodsSource==='JD'){res.OrderInfo.OrderItems.GoodsSource='京东';}elseif(res.OrderInfo.OrderItems.GoodsSource==='SF'){res.OrderInfo.OrderItems.GoodsSource='顺丰';}elseif(res.OrderInfo.OrderItems.GoodsSource==='SELF'){res.OrderInfo.OrderItems.GoodsSource='商户自营';}
2 回答
慕沐林林
TA贡献2016条经验 获得超9个赞
constMAP={'JD':'京东','SF':'顺丰','SELF':'商户自营'}res.OrderInfo.OrderItems.GoodsSource=MAP[res.OrderInfo.OrderItems.GoodsSource]||'未知'
添加回答
举报
0/150
提交
取消