[Vuejs]-How to access methods of object passed via props to component

0đź‘Ť

âś…

Why you write it like this: v-bind:address="AddressModel = { street: 'Bleeker', streetNr: '1' }"? What do you expect? Especially when you don’t even import “AddressModel”. Have a look at examples https://class-component.vuejs.org/guide/class-component.html#data

This will probably work:

<template>
  <div>
     <AddressDisplay v-bind:address="address" />
  </div>
</template>

<script lang="ts">
import Vue from 'vue';
import AddressDisplay from '@/components/AddressDisplay.vue';

export default Vue.extend({
  components: { AddressDisplay },
  data(){ return {
   address: { street: 'Bleeker', streetNr: '1' }
  }}
});
</script>

Leave a comment