Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
La sección sin datos se carga primero y luego muestra los datos en v-data-table

Estoy usando vuetify v-data-table para mostrar datos. El problema al que me enfrento aquí es que el mensaje Sin configuración todavía siempre se muestra durante 1 segundo y luego muestra los datos. Es como si ningún mensaje de datos se carga primero y luego aparecen los datos reales. ¿Hay alguna manera de arreglar esto?

 <template> <div> <v-card> <v-data-table :headers="headers" :items="settings" hide-default-footer disable-pagination :mobile-breakpoint="0"> <template slot="top" v-if="isLoading"> <v-progress-linear indeterminate color="red" ></v-progress-linear> </template> <template slot="item" slot-scope="props"> <tr> <td>{{ props.item.name }}</td> <td>{{ props.item.value }}</td> </tr> </template> <template slot="no-data" > <v-alert id='no-data' :value="true" color="error" icon="warning"> No Settings Yet </v-alert> </template> </v-data-table> </v-card> </div> </template> <script> export default { data: function() { return { settings: [], headers: [ { text: 'Name', value: 'name'}, { text: 'Value', value: 'value'}, { text: 'Actions', sortable: false} ], isLoading: false } }, created() { this.fetchSettings(); }, methods: { fetchSettings() { var that = this; that.isLoading = true; this.$axios.get('/settings.json') .then(response => { that.settings = response.data; that.isLoading = false; }); } } } </script>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Desde el punto de vista de v-data-table en su caso, solo hay 2 estados: los datos están presentes o no (todavía). Es por eso que la ranura no-data siempre está visible al cargar.

Si desea mostrar el mensaje "Cargando" y la alerta "Todavía no hay configuraciones" en este espacio, puede hacerlo de esta manera:

 <v-data-table :headers="headers" :items="desserts" :search="search" hide-default-footer disable-pagination :mobile-breakpoint="0" > <template #top> <v-progress-linear v-show="isLoading" indeterminate color="red" /> </template> <template #no-data> <v-alert v-show="!isLoading" :value="true" color="error" icon="warning"> No Settings Yet </v-alert> <span v-show="isLoading">Loading...</span> </template> </v-data-table>

Consulte este patio de recreo de CodePen para una mejor comprensión. Allí también podrá comprender la diferencia entre las tragamonedas no-data y no-results .

about 4 years ago · Juan Pablo Isaza Report

0

Creo que puede hacer esto agregando la directiva v-if en la ranura sin datos como el siguiente ejemplo

 <template slot="no-data" v-if="!isLoading"> <v-alert id='no-data' :value="true" color="error" icon="warning"> No Settings Yet </v-alert> </template>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!