D
D
dicem2019-02-12 06:36:56
Vue.js
dicem, 2019-02-12 06:36:56

Why does the variable return an empty object?

Straight to the point...

I'm trying to get data from json and put it in productData, but when I call console.log(this.productData) inside the method, it works fine, and when, after the method has worked, I try to display it in the console, an empty object is displayed. How does this happen and what am I doing wrong?
5c623f56489ca666582356.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Medin K, 2019-02-12
@dicem

use async await to wait for a response or return a promise and chain
https://jsfiddle.net/e152nz34/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question