用switch做感觉代码还是很多, 还有更简洁的方式吗?
<div
class="title"
>
{{ orderStateValue }}
</div>
init() {
switch (res.OrderInfo.OrderState) {
case 'Wait':
this.orderStateValue = '兑换成功,等待发货';
break;
case 'Sent':
this.orderStateValue = '商家已发货';
break;
case 'Cancel':
this.orderStateValue = '订单已取消';
break;
case 'Fail':
this.orderStateValue = '订单失败';
break;
default:
break;
}
}