I am using vue2 and I am trying to fetch an api and render the contents in my page, this is all done in my Orgs.vue
file and here is the code:
<template lang="html">
<div class="">
{{ orgs | json }}
</div>
</template>
<script>
export default {
data: {
orgs: false
},
created() {
request = axios({
url: 'https://....',
method: 'GET',
})
.then(function(response) {
this.orgs = response;
})
.catch(function(error) {
console.log('error getting orgs::', error);
});
}
};
</script>
<style lang="css">
</style>
However everytime I run the page I get this error:
Property or method "orgs" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. found in Orgs.vue
I tried to change
data: {
orgs: false
},
to
data() {
return {orgs: false}
},
but the error is still there