Compare commits

..

1 Commits

Author SHA1 Message Date
Tim 140d33d024 feat: support IconPark icons in BaseTimeline 2025-09-06 11:44:13 +08:00
2 changed files with 11 additions and 7 deletions
@@ -7,6 +7,11 @@
@click="item.iconClick && item.iconClick()" @click="item.iconClick && item.iconClick()"
> >
<BaseImage v-if="item.src" :src="item.src" class="timeline-img" alt="timeline item" /> <BaseImage v-if="item.src" :src="item.src" class="timeline-img" alt="timeline item" />
<component
v-else-if="item.icon && (typeof item.icon !== 'string' || !item.icon.includes(' '))"
:is="item.icon"
:size="20"
/>
<i v-else-if="item.icon" :class="item.icon"></i> <i v-else-if="item.icon" :class="item.icon"></i>
<BaseImage v-else-if="item.emoji" :src="item.emoji" class="timeline-emoji" alt="emoji" /> <BaseImage v-else-if="item.emoji" :src="item.emoji" class="timeline-emoji" alt="emoji" />
</div> </div>
+6 -7
View File
@@ -24,7 +24,7 @@
</template> </template>
<template #option="{ option }"> <template #option="{ option }">
<div class="search-option-item"> <div class="search-option-item">
<component :is="iconMap[option.type]" class="result-icon" /> <i :class="['result-icon', iconMap[option.type]]"></i>
<div class="result-body"> <div class="result-body">
<div class="result-main" v-html="highlight(option.text)"></div> <div class="result-main" v-html="highlight(option.text)"></div>
<div v-if="option.subText" class="result-sub" v-html="highlight(option.subText)"></div> <div v-if="option.subText" class="result-sub" v-html="highlight(option.subText)"></div>
@@ -83,12 +83,11 @@ const highlight = (text) => {
} }
const iconMap = { const iconMap = {
user: 'UserIcon', user: 'fas fa-user',
post: 'FileText', post: 'fas fa-file-alt',
post_title: 'FileText', comment: 'fas fa-comment',
comment: 'CommentIcon', category: 'fas fa-folder',
category: 'Inbox', tag: 'fas fa-hashtag',
tag: 'TagOne',
} }
watch(selected, (val) => { watch(selected, (val) => {