How to parse {__ob__: Observer} using a for .. in ..?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
43 views
Hello! Get json from the server, then writes the resulting value into a variable and deduce in the console: displays {__ob__: Observer}. Can't make it through for in and somehow refer to the object key. What is this? Thank you.
get_details(id) { axios.get(url ).then((response) => { console.log(response.data["detail"]) this.details = { ...response.data["detail"] }; }).catch((error) => { console.log(error); }); console.log(this.details); }
by | 43 views

2 Answers

0 like 0 dislike
Did the following:
get_details(id) { let url = 'http://127.0.0.1:8000/api/company/' + id + '/details?detail=1'; let are; axios.get(url ).then((response) => { let Observer = this.$data.__ob__.constructor; response.data["detail"].__ob__ = new Observer({}); are = response.data["detail"]; let content = { "id": id, "content": are }; this.$store.dispatch('set_company_card_content', content); this.draw(this.$store.getters.get_company_card_content); }).catch((error) => { console.log(error); }); }, draw(value) { this.about_company = value[0].content.about_company; }


In draw() you can now select the desired value and use as directed.
by
0 like 0 dislike
On the question of "what is" answer is easy: this is the object-observer vue slips instead of your data.

To the question "how to rascality back" is more difficult to answer. Will have to rummage in docks at the vue.
Here here , like described in human language what's really going on inside. Perhaps the best option would be to put vue devtools.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
27,922 users