mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
feat: 添加更新日志功能;优化组件和状态管理;修复部分逻辑错误
This commit is contained in:
@@ -139,7 +139,7 @@ const showContent = ref(!isViolation)
|
||||
<br>
|
||||
</template>
|
||||
|
||||
<NText :style="{ filter: showContent ? '' : 'blur(3.7px)', cursor: showContent ? '' : 'pointer' }">
|
||||
<NText :style="{ filter: showContent ? '' : 'blur(3.7px)', cursor: showContent ? '' : 'pointer', whiteSpace: 'pre-wrap' }">
|
||||
<NButton
|
||||
v-if="isViolation"
|
||||
size="small"
|
||||
|
||||
@@ -16,6 +16,7 @@ onMounted(() => {
|
||||
window.$route = useRoute()
|
||||
window.$modal = useModal()
|
||||
window.$notification = useNotification()
|
||||
window.$dialog = useDialog()
|
||||
const providerStore = useLoadingBarStore()
|
||||
providerStore.setLoadingBar(window.$loadingBar)
|
||||
})
|
||||
|
||||
93
src/components/UpdateNoteContainer.vue
Normal file
93
src/components/UpdateNoteContainer.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<script setup lang="ts">
|
||||
import { updateNoteItemContentType, updateNotes } from '@/data/UpdateNote';
|
||||
import { NDivider, NGrid } from 'naive-ui';
|
||||
import { VNode } from 'vue';
|
||||
|
||||
const currentVer = '1'
|
||||
const savedVer = useStorage('UpdateNoteVer', 0)
|
||||
function renderContent(content: updateNoteItemContentType): VNode | string | undefined {
|
||||
if (Array.isArray(content)) {
|
||||
return h('div', { style: { whiteSpace: 'pre-wrap' } }, content.map(item => renderContent(item)))
|
||||
}
|
||||
if (typeof content === 'string') {
|
||||
return content
|
||||
}
|
||||
if (typeof content === 'function') {
|
||||
return content()
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NScrollbar
|
||||
style="max-height: 80vh;"
|
||||
trigger="none"
|
||||
>
|
||||
<NFlex vertical>
|
||||
<div
|
||||
v-for="item in updateNotes"
|
||||
:key="item.ver"
|
||||
>
|
||||
<NDivider title-placement="left">
|
||||
{{ item.date }}
|
||||
</NDivider>
|
||||
<NGrid
|
||||
x-gap="10"
|
||||
>
|
||||
<template
|
||||
v-for="note in item.items"
|
||||
:key="note.title"
|
||||
>
|
||||
<NGridItem span="6">
|
||||
<div style="">
|
||||
<NTag
|
||||
v-if="note.type === 'fix'"
|
||||
type="info"
|
||||
round
|
||||
:bordered="false"
|
||||
>
|
||||
错误修复
|
||||
</NTag>
|
||||
<NTag
|
||||
v-else-if="note.type === 'new'"
|
||||
type="success"
|
||||
round
|
||||
:bordered="false"
|
||||
>
|
||||
功能添加
|
||||
</NTag>
|
||||
<NTag
|
||||
v-else-if="note.type === 'optimize'"
|
||||
:color="{ textColor: '#000', color: '#f0ad4e', borderColor: '#f0ad4e' }"
|
||||
round
|
||||
:bordered="false"
|
||||
>
|
||||
功能优化
|
||||
</NTag>
|
||||
<NTag
|
||||
v-else-if="note.type === 'other'"
|
||||
type="error"
|
||||
round
|
||||
:bordered="false"
|
||||
>
|
||||
其他
|
||||
</NTag>
|
||||
</div>
|
||||
</NGridItem>
|
||||
<NGridItem span="18">
|
||||
<NFlex vertical>
|
||||
<template
|
||||
v-for="content in note.content"
|
||||
:key="content"
|
||||
>
|
||||
<component :is="renderContent(content)" />
|
||||
</template>
|
||||
</NFlex>
|
||||
</NGridItem>
|
||||
</template>
|
||||
</NGrid>
|
||||
</div>
|
||||
</NFlex>
|
||||
</NScrollbar>
|
||||
</template>
|
||||
Reference in New Issue
Block a user