I'm trying to write a simple function in the methods. It should create an array out of JSON data.
The JSON object is called page with another object called images containing height, orientation etc.
setup () {
return {
page: usePage(),
}
},
methods: {
getOrientations() {
this.page.images.forEach((item) => {
console.log(item
})
}
Unfortunately it throws an undefined is not an object error. Logging only this.page however prints the whole object.
Does this.page.images not work when using it inside a method? Because it works when using it "inline" in HTML.
Thanks for any tips!
setup? I never saw this in Vue. It should bedatainstead.