How to use computed to calculate the object of the first OrderItems?

// computedOrderItems
this.thumbnail = res.OrderInfo.OrderItems[0].Thumbnail;
this.goodsSource = res.OrderInfo.OrderItems[0].GoodsSource;
this.goodsName = res.OrderInfo.OrderItems[0].GoodsName;
this.count = res.OrderInfo.OrderItems[0].Count;
this.spec = res.OrderInfo.OrderItems[0].Spec;

data

clipboard.png

Apr.12,2022

new Vue({
  data:{
    orderItems: null;
  },
  computed:{
    firstOrderItem(){
      return orderItems != null && orderItems.length > 0 ? orderItems[0] : null;
    }
  },
  methods:{
    getData: function(){
      axios.get('url', someParams).then(res->{this.orderItems = res.data.OrderItems})
    }
  }
});
Menu