吴雨瞳添加了注释

master
wyt 6 months ago
parent c1db889167
commit 3483020e77

@ -1,9 +1,22 @@
<template>
<!-- 侧边栏标签盒子组件容器应用sidebar-box样式 -->
<div class="sidebar-box">
<!-- 子标题组件显示标题为国际化的"标签列表"图标为标签图标 -->
<SubTitle :title="'titles.tag_list'" icon="tag" />
<!-- 标签列表容器组件 -->
<TagList>
<!-- 当标签数据存在且不为空时渲染标签列表 -->
<template v-if="tags != '' && tags.length > 0">
<TagItem v-for="tag in tags" :key="tag.id" :id="tag.id" :name="tag.tagName" :count="tag.count" size="xs" />
<!-- 遍历标签数据渲染每个标签项 -->
<TagItem
v-for="tag in tags"
:key="tag.id"
:id="tag.id"
:name="tag.tagName"
:count="tag.count"
size="xs"
/>
<!-- 查看更多标签链接跳转到标签列表页 -->
<div class="flex flex-row items-center hover:opacity-50 mr-2 mb-2 cursor-pointer transition-all">
<span class="text-center px-3 py-1 rounded-md text-sm">
<b class="border-b-2 border-ob hover:text-ob">
@ -17,29 +30,47 @@
</template>
<script lang="ts">
// Vue
import { defineComponent, onMounted, toRef } from 'vue'
//
import { SubTitle } from '@/components/Title'
//
import { useTagStore } from '@/stores/tag'
//
import { TagList, TagItem } from '@/components/Tag'
//
import { useI18n } from 'vue-i18n'
// API
import api from '@/api/api'
//
export default defineComponent({
name: 'ObTag',
//
components: { SubTitle, TagList, TagItem },
setup() {
//
const tagStore = useTagStore()
//
const { t } = useI18n()
// 10
onMounted(() => {
fetchTopTenTags()
})
// 10API
const fetchTopTenTags = () => {
api.getTopTenTags().then(({ data }) => {
tagStore.homeTags = data.data
})
}
// 使
return {
//
tags: toRef(tagStore.$state, 'homeTags'),
//
t
}
}
@ -47,7 +78,8 @@ export default defineComponent({
</script>
<style lang="scss">
//
.sidebar-box li.ob-skeleton {
@apply mr-2 mb-2;
}
</style>
</style>
Loading…
Cancel
Save