feat: add community tag icons

This commit is contained in:
hajimi
2026-08-02 02:14:40 +08:00
parent 73f1c2ceba
commit a6531a3ab1
4 changed files with 39 additions and 2 deletions
+9 -1
View File
@@ -33,7 +33,8 @@
<view class="community-topics__list">
<view v-for="tag in displayTags" :key="tag.id" class="community-topic"
:class="{ 'community-topic--active': activeTagId === tag.id }" @tap="selectTag(tag)">
<text class="community-topic__icon" :style="{ color: tag.theme.color }">{{ tag.theme.icon }}</text>
<image v-if="tag.icon" class="community-topic__icon-image" :src="tag.icon" mode="aspectFit" />
<text v-else class="community-topic__icon" :style="{ color: tag.theme.color }">{{ tag.theme.icon }}</text>
<text>{{ tag.name }}</text>
</view>
</view>
@@ -129,6 +130,7 @@ const TOPIC_THEMES = [
const displayTags = computed(() => {
return tagList.value.map((tag, index) => ({
...tag,
icon: typeof tag.icon === 'string' ? tag.icon.trim() : '',
theme: TOPIC_THEMES[index % TOPIC_THEMES.length]
}))
})
@@ -546,6 +548,12 @@ onShow(() => {
line-height: 1;
}
&__icon-image {
width: 32rpx;
height: 32rpx;
flex-shrink: 0;
}
&--active {
border-color: #1468f5;
color: #1468f5;