Files
vtsuru.live/src/components/UpdateNoteContainer.vue
Megghy f267592e37 feat: 更新 UpdateNoteContainer 组件和 IndexView 视图,增强功能和用户体验
- 在 UpdateNoteContainer 组件中优化了内容渲染逻辑,简化了代码结构。
- 在 UpdateNote.ts 中新增版本 4 的更新记录,添加自动操作功能的详细说明。
- 在 IndexView 视图中引入新的图标,更新了功能列表,增强了用户界面。
- 改进了样式和布局,提升了整体视觉效果和用户交互体验。
2025-04-22 23:11:32 +08:00

91 lines
2.5 KiB
Vue

<script setup lang="ts">
import { updateNoteItemContentType, updateNotes } from '@/data/UpdateNote';
import { NDivider, NGrid } from 'naive-ui';
import { VNode } from 'vue';
function renderContent(content: updateNoteItemContentType): VNode | string | undefined {
if (Array.isArray(content)) {
return h('div', { style: { whiteSpace: 'pre-wrap' } }, content.map(item => renderContent(item)))
}
const getContent = (c: unknown) => {
if (typeof c === 'string') {
return c
}
if (typeof c === 'function') {
return c()
}
}
return h('span', { style: { whiteSpace: 'pre-wrap' } }, getContent(content))
}
</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>