feat: add community tag icons
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user