[Vuejs]-Printing received JSON into a table

4👍

First of all, your code structure is disrupted. You shouldn’t define computed,created and methods functions outside the export default module.

I created a sandbox for you just to rearrange the code and assign the value of response to items variable.

.then(response => (this.items = response.data));

If i assume correctly you are using Bootstrap-Vue plugin. After obtaining the items object you can follow the documentation from here

0👍

First of all, your initial value for items in data should be [] (an empty array).

After that, pretty much all you should need to do is set this.items = response.data when you get the JSON back. Although the code you pasted seems to be bad (the axios.post call is directly under methods).

Leave a comment