Skip to content

Commit

Permalink
simulate loading from API
Browse files Browse the repository at this point in the history
  • Loading branch information
wbbaker committed Aug 2, 2024
1 parent 41272da commit b3875a0
Showing 1 changed file with 31 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,50 @@
<VCard>
<ClientOnly>
<VSpinner
v-if="isLoading"
logo-class="w-8 h-8"
legend=""
v-if="isLoading"
logo-class="w-8 h-8"
legend=""
/>
</ClientOnly>
<VCardHeader class="flex justify-between">
<h2 class="text-md">Collection Objects</h2>
<PanelDropdown panel-key="panel:collection-objects" />
</VCardHeader>
<VCardContent class="text-sm">
<p>Placeholder.</p>
<p v-html="content"/>
</VCardContent>
</VCard>
</template>

<script setup>
import { ref } from 'vue'
import { ref, watch } from 'vue'
import PanelDropdown from '../PanelDropdown.vue'
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
const props = defineProps({
otuId: {
type: [String, Number],
required: true
}
})
const content = ref("Loading...")
const isLoading = ref(false)
watch(
() => props.otuId,
async () => {
if (!props.otuId) {
content.value = 'No OTU specified.'
return
}
isLoading.value = true
await sleep(2000)
content.value = `Collection objects content for ${props.otuId}.`
isLoading.value = false
},
{immediate: true}
)
</script>

0 comments on commit b3875a0

Please sign in to comment.