Hi, thanks for the article, just what I've been looking for. So if I have an api request in a method, then I define the result variables, and then in a function call the api?
export default { setup() { const content = null; function fetchData() { jobService.getMyJobs() .then((response) => { this.content = response; } .catch((error) => { console.log(error); }); } return { content, fetchData } }
I don't think you need this.content = response
this.content = response
Just content = response
content = response
Hi, content (without this) doesn't pick up the value of response. Do you know why? Thanks.
Ignore me, need to add . value... content.value = response.data. ...
yeah sorry! I forgot, haven't used vue3 in a couple months.
Totally right though. .value to get the value. Thanks for updating!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, thanks for the article, just what I've been looking for. So if I have an api request in a method, then I define the result variables, and then in a function call the api?
I don't think you need
this.content = response
Just
content = response
Hi, content (without this) doesn't pick up the value of response. Do you know why? Thanks.
Ignore me, need to add . value...
content.value = response.data. ...
yeah sorry! I forgot, haven't used vue3 in a couple months.
Totally right though. .value to get the value. Thanks for updating!