吴雨瞳添加了注释

master
wyt 6 months ago
parent 3483020e77
commit 9d929b8885

@ -1,65 +1,104 @@
<template>
<!-- 侧边栏网站信息组件容器应用sidebar-box样式 -->
<div class="sidebar-box">
<!-- 子标题组件显示标题为国际化的"网站信息"图标为网站信息图标 -->
<SubTitle :title="'titles.website_info'" icon="website-info" />
<!-- 网站信息列表容器水平居中 -->
<ul class="mx-auto">
<!-- 网站运行时间信息项 -->
<li class="pb-3">
<!-- 标签文本国际化的"运行时间"使用小号字体和中等字重 -->
<span class="text-sm font-medium">{{ t('settings.running-time') }}:</span>
<!-- 运行时间值当有数据时显示右对齐 -->
<span class="text-sm font-medium text-right float-right" v-if="websiteCreateTime != ''">
{{ websiteCreateTime }}
</span>
<!-- 骨架屏当无数据时显示占位宽度136px高度16px -->
<ob-skeleton v-else class="float-right" tag="span" width="136px" height="16px" />
</li>
<!-- 网站访问量信息项 -->
<li class="pb-2">
<!-- 标签文本国际化的"访问量"使用小号字体和中等字重 -->
<span class="text-sm font-medium">{{ t('settings.view-count') }}:</span>
<!-- 访问量值当有数据时显示右对齐 -->
<span class="text-sm font-medium text-right float-right" v-if="viewCount">{{ viewCount }}</span>
<!-- 骨架屏当无数据时显示占位宽度60px高度16px -->
<ob-skeleton v-else class="float-right" tag="span" width="60px" height="16px" />
</li>
</ul>
</div>
</template>
<script lang="ts">
// Vue
import { defineComponent, onMounted, onUnmounted, ref } from 'vue'
//
import { SubTitle } from '@/components/Title'
//
import { useAppStore } from '@/stores/app'
//
import { useI18n } from 'vue-i18n'
//
export default defineComponent({
name: 'WebsiteInfo',
//
components: { SubTitle },
setup() {
//
const { t } = useI18n()
//
const appStore = useAppStore()
//
const websiteCreateTime = ref('')
// 访
const viewCount = ref(0)
//
let timer: any
//
onMounted(() => {
runTime()
timer = setInterval(runTime, 1000)
})
//
onUnmounted(() => {
clearInterval(timer)
})
//
const runTime = () => {
//
if (!appStore.websiteConfig.websiteCreateTime) {
return
}
//
let timeold = new Date().getTime() - new Date(appStore.websiteConfig.websiteCreateTime).getTime()
//
let msPerDay = 24 * 60 * 60 * 1000
//
let daysold = Math.floor(timeold / msPerDay)
let str = ''
//
let day = new Date()
//
let str = ''
str += daysold + '天'
str += day.getHours() + '时'
str += day.getMinutes() + '分'
str += day.getSeconds() + '秒'
//
websiteCreateTime.value = str
// 访
viewCount.value = appStore.viewCount
}
// 使
return {
websiteCreateTime,
viewCount,
t
websiteCreateTime, //
viewCount, // 访
t //
}
}
})
</script>
</script>
Loading…
Cancel
Save