A step-by-step guide on implementing easydatatable in Vue.js with the help of Axios

I am fetching this information using axios

{
  "qtp1459016715-18382027": {
    "name": "qtp1459016715-18382027",
    "status": "5",
    "priority": 5,
    "thread-id": 18382027,
    "group": "main",
    "daemon": false,
    "stacktrace": ["org.apache.solr"],
     // more data here...
  },
}

This code is from the app.vue file where I intend to show a table

  <EasyDataTable :headers="headers" :items="items">
    <template #expand="items">
      <div style="padding: 15px">
        <h3>{{ items.name }}</h3>
      </div>
    </template>
  </EasyDataTable>
  data() {
    return {
      headers: [],
      items: [],
    };
  },
  async created() {
    this.headers = [
      { text: "THREAD NAME", value: "name"},
      { text: "THREAD STATUS", value: "status"},
       // more header fields here...
    ];
    this.items = await axios.get(`http://localhost:3000/threads`);
}

I want to display the data in a table similar to the image provided, but with the data structured according to the headers mentioned above

Answer №1

Make sure to use the .then() method in your axios function:

axios.get(`${apiBaseUrl}/getUser`, {
          headers: {
            Authorization: `Bearer ${access_token}`,
          },
        }).then((res) => {
          // items.push(res.data);
          items.value = res.data;
        }).catch((error) => {
          console.error(error);
        });

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Transform the v-model value from numerical to textual representation

Currently, I am using the <q-select> component and populating it with options fetched from an API. The issue arises when setting the value as the ID of the object, which is a number while the component expects a string, resulting in an error. <s- ...

Integrating Vue Router with a CFML (Lucee) server

I have a Vue Router set up that is working flawlessly for navigation using <router-link to="/test">test</router-link>, but when I manually type the URL into the browser like , it reloads the page and shows a 404 error. On the server-side, I ...

Personalized message on Vuetify slider

Is there a way to customize the message displayed on a Vuetify slider? https://i.stack.imgur.com/6Xdsm.png I want to include text like 'The number is: 8' <v-slider class='slider' step="1" thumb- ...

Acquiring a value from a RefImpl using the Vue 3 composition API

When using the useGeolocation function from @vueuse/core in my code, I encountered an issue where it returned an Infinity value when trying to retrieve latitude and longitude coordinates. What could be causing this problem, and how can I ensure it returns ...

Effortlessly uploading large files using axios

I am currently facing an issue and I am seeking assistance. My goal is to implement file chunk upload using axios, where each chunk is sent to the server sequentially. However, the requests are not being sent in order as expected. Below is a snippet of m ...

Tips for integrating TypeScript with Vue.js and Single File Components

After extensive searching online, I have struggled to find a straightforward and up-to-date example of setting up Vue.js with TypeScript. The typical tutorials out there either are outdated or rely on specific configurations that don't apply universal ...

Troubleshooting Axios Interceptor issue post page refresh in Vue.js

I've been working on a simple CRUD application using Spring, Vue.js, and H2 database. The development is almost complete, but I encountered some authentication issues. After entering all the required credentials, the login is successful, and I'm ...

Guide on resolving the error "Type 'Emits' does not have any call signatures" in Vue 3 with the combination of script setup and TypeScript

I've come across some code that seems to be functioning properly, but my IDE is flagging it with the following warnings: TS2349: This expression is not callable. Type 'Emits' has no call signatures Below is the code snippet in question: ...

The UglifyJsPlugin in Webpack encounters an issue when processing Node modules that contain the "let" keyword

Below is the code snippet from my project which utilizes Vue.js' Webpack official template: .babelrc: "presets": [ "babel-preset-es2015", "babel-preset-stage-2", ] webpack.prod.config.js new webpack.optimize.UglifyJsPlugin({ compress: { ...

What is the best way to set the v-model property to an object that is constantly changing

I'm in the process of creating a dynamic form that allows users to add additional fields by simply clicking on a button labeled "adicionar condição." The concept is similar to what can be seen in the screenshot below: https://i.stack.imgur.com/Mpmr6 ...

What is preventing me from updating specific packages to the latest version using vue ui / npm?

Currently, I am utilizing Vue CLI and have been using the command vue ui to facilitate updating npm packages. Upon executing this command, I encountered a particular screen as displayed in the following image: https://i.stack.imgur.com/6cDlI.png I am see ...

What Causes the Response to Vary in a Post Request?

Issue: When I use console.log(res.data), it shows different data compared to console.log(JSON.parse(res.request.response)). My Next.js application is sending a post request to an internal API. The response from the REST endpoint should contain a list obje ...

The return value from vue-query is ObjectRefImpl, not the actual data

Greetings to the Vue.js community! As a newcomer to Vue.js, I am seeking guidance on fetching data using vue-query, Vue.js 3, and the composition API. The data returned to me is ObjectRefImpl, but when I try to print the values, I encounter the error: "Pro ...

Utilizing markers for gaming in a data table with Vue and Vuetify

I am struggling to retrieve the games of teams from two objects with arrays in Vue. One object contains headers for a data table, while the other object contains status information. Despite my efforts, I have not been successful in fetching the game detail ...

Avoiding substantial sections during execution of the command "Npm run build"

Encountering an issue when attempting to execute "npm run build" (!) Encountered chunks larger than 500 KiB after minification. Suggestions: - Implement dynamic import() for code-splitting the application - Utilize build.rollupOptions.output.ma ...

Guide to using Vue.js to automatically populate a form with data retrieved from a get request

I am looking to retrieve data using a GET request and populate the input data attributes in vue.js 3, like so: <input id="name" type="text" v-bind:placeholder="$t('message.NamePlaceholder')" value="{{ name }} ...

Create a data attribute object and assign to it the prop object received from the parent component

I am struggling with passing an object as a prop from a parent component and then utilizing it to initialize the child component with the received value. The main objective behind this is to create a dialog box that includes a child form component with mu ...

Tracking and managing user clicks on external links within a vue.js application

I am currently working on a web application that retrieves data from a CMS. Utilizing the Vue-Router in 'history' mode, I need to address content fetched from the API which may include links. My goal is to manage specific links using the router w ...

What is the best method to retrieve a nested JSON property that is deeply embedded within

I am facing an issue with storing a HEX color code obtained from an API in a Vue.js app. The object app stores the color code, for example: const app = {"theme":"{\"color\":\"#186DFFF0\"}"}. However, when I try to access the color prope ...

Element UI is a powerful user interface library designed specifically for Vue

Is there a way to programmatically trigger or hide the dropdown when using the el-dropdown component from , especially when split-button is set to true? In my previous experience with using React and bootstrap, I could accomplish this by utilizing ref or ...