docs(chip): update

This commit is contained in:
Benjamin Canac
2024-07-26 16:13:02 +02:00
parent 2f57c43361
commit bcaca46ccc
7 changed files with 158 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
<script setup lang="ts">
const statuses = ['online', 'offline', 'busy', 'away']
const status = ref(statuses[0])
const color = computed(() => ({
online: 'green',
offline: 'gray',
busy: 'red',
away: 'amber'
})[status.value] as any)
const show = computed(() => status.value !== 'offline')
// Note: This is for demonstration purposes only. Don't do this at home.
onMounted(() => {
setInterval(() => {
status.value = statuses[Math.floor(Math.random() * statuses.length)]
}, 1000)
})
</script>
<template>
<UChip :color="color" :show="show" inset>
<UAvatar src="https://avatars.githubusercontent.com/u/739984?v=4" />
</UChip>
</template>