mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
61 lines
1006 B
Vue
61 lines
1006 B
Vue
<template>
|
|
<component
|
|
:is="iconComponent"
|
|
v-if="iconComponent"
|
|
:size="size"
|
|
v-bind="$attrs"
|
|
/>
|
|
<span
|
|
v-else
|
|
v-bind="$attrs"
|
|
>{{ fallback }}</span>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, type Component } from 'vue'
|
|
import {
|
|
Dingtalk,
|
|
Qq,
|
|
Telegram,
|
|
Discord,
|
|
Slack,
|
|
Feishu,
|
|
Wechat,
|
|
Wechatoa,
|
|
Wecom,
|
|
Matrix,
|
|
} from '@memohai/icon'
|
|
|
|
const channelIcons: Record<string, Component> = {
|
|
qq: Qq,
|
|
telegram: Telegram,
|
|
discord: Discord,
|
|
slack: Slack,
|
|
feishu: Feishu,
|
|
wechat: Wechat,
|
|
weixin: Wechat,
|
|
wechatoa: Wechatoa,
|
|
wecom: Wecom,
|
|
matrix: Matrix,
|
|
// misskey: Misskey,
|
|
dingtalk: Dingtalk,
|
|
}
|
|
|
|
const props = withDefaults(defineProps<{
|
|
channel: string
|
|
size?: string | number
|
|
}>(), {
|
|
size: '1em',
|
|
})
|
|
|
|
defineOptions({ inheritAttrs: false })
|
|
|
|
const iconComponent = computed<Component | undefined>(() =>
|
|
channelIcons[props.channel],
|
|
)
|
|
|
|
const fallback = computed(() =>
|
|
props.channel.slice(0, 2).toUpperCase(),
|
|
)
|
|
</script>
|