Azik
326
5
Vue

After assign a data property equal to a props returns null..

Posted 1 month ago by Azik

this is my code ?

<template>
  <div>{{ addresses }}</div>  <!-- // returns an Array { "id": 1, "name": "Green test", "address_1": "Address", "city": "city", "postal_code": "123456", "country": { "id": 2, "code": "AL", "name": "ALBANIA " }, "default": 0 }  -->
</template>
<script>
export default {
  props: {
    addresses: {
      required: true,
      type: Array
    }
  },
  data() {
    return {
      localAddresses: this.addresses // returns empty
    };
  },
  created() {
    console.log(this.addresses); // returns empty
  }
};
</script>

Please sign in or create an account to participate in this conversation.