This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
118 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
import { NAvatar, NPopover } from 'naive-ui' | ||
const props = defineProps<{ | ||
url: string | string[] | ||
}>() | ||
function makeUrl(v: string | null) { | ||
return v ? `/res/${v}` : '/favicon-32x32.png' | ||
} | ||
const first = computed(() => { | ||
return props.url instanceof Array | ||
? props.url.length > 0 | ||
? props.url[0] | ||
: null | ||
: props.url | ||
}) | ||
</script> | ||
|
||
<template> | ||
<NPopover trigger="hover" placement="bottom"> | ||
<template #trigger> | ||
<!-- <img :src="url" /> --> | ||
<div class="w-8 h-8 flex justify-center items-center"> | ||
<NAvatar object-fit="contain" :src="makeUrl(first)"></NAvatar> | ||
</div> | ||
</template> | ||
|
||
<div class="flex flex-col items-center"> | ||
<template v-if="props.url instanceof Array"> | ||
<img v-for="(u, i) in props.url" :key="i" :src="makeUrl(u)" /> | ||
</template> | ||
<img v-else :src="makeUrl(first)" /> | ||
</div> | ||
</NPopover> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters