Displaying list elements
In this section, we deal with the first display of the page. Insertion has been seen previously, and modification and deletion are covered in the following sections.
Note
To display the list when the application starts, you must use the created()
method or the mounted()
method of the component, which are called in each Vue.js component when the component is created.
To retrieve the list of elements, we are going to use an HTTP GET
request.
Using Axios with a GET type request (client side)
Here, we are going to make a GET
type request with the /list
URL to the server. The axios.get("/list")
instruction is used to perform this request. We can use this instruction in the created()
or mounted()
method. Here, we choose to use it in the created()
method:
Retrieving list of items, client side (global-app.js file)
import Element from "./element.js"; const GlobalApp = { data() { return { ...