add loading.

This commit is contained in:
m1k1o
2021-03-08 20:30:43 +01:00
parent 433344e401
commit 36ed479dae
2 changed files with 21 additions and 3 deletions
+5 -1
View File
@@ -3,6 +3,8 @@
:headers="headers"
:items="rooms"
class="elevation-1"
:loading="loading"
loading-text="Loading... Please wait"
>
<template v-slot:[`item.url`]="{ item }">
<a :href="item.url"> Link </a>
@@ -18,10 +20,12 @@
</template>
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import { Vue, Component, Prop } from 'vue-property-decorator'
@Component
export default class RoomsList extends Vue {
@Prop(Boolean) readonly loading: boolean = false
private headers = [
{ text: 'Name', value: 'name' },
{ text: 'Link', value: 'url' },
+16 -2
View File
@@ -1,6 +1,8 @@
<template>
<v-container>
<RoomsList />
<v-btn @click="LoadRooms" class="mb-3" color="green" icon><v-icon>mdi-refresh</v-icon></v-btn>
<RoomsList :loading="loading" />
</v-container>
</template>
@@ -13,5 +15,17 @@ import RoomsList from '@/components/RoomsList.vue'
RoomsList
}
})
export default class Home extends Vue {}
export default class Home extends Vue {
private loading = false
async LoadRooms() {
this.loading = true
try {
await this.$store.dispatch('ROOMS_LOAD')
} finally {
this.loading = false
}
}
}
</script>