What should be done after receiving the value data passed by vue father and son?

// 
<h4>{{ orderInfo.OrderItems[0].GoodsName }}</h4>

// 
  props: {
    list: {
      type: Object,
      required: true,
      default: () => ({
        OrderTrackInfo: [],
        OrderInfo: {},
        OrderItems: [],
      }),
    },
  },

  computed: {
    orderInfo() {
      return this.list.OrderInfo || {};
    },

    logisticsList() {
      return this.list.OrderTrackInfo;
    },

    orderItems() {
      // 0, 
      return this.list.OrderInfo.OrderItems[0] || {};
    },
  },

will still report undefined errors,
clipboard.png

clipboard.png

Apr.13,2022

it should be so. The data is misdefined


,list:

orderItems() {
  console.log(this.list) // list
  // return this.list.OrderInfo.OrderItems[0] || {};
},

then process the relevant data.

Menu