fix: 修正了一些拼写错误,略微完成了一些文章部分的开发

This commit is contained in:
539943419 committed 2025-01-12 21:19:45 +08:00
1 parent 2955e0fe47
commit 6be2c9a0d7
15 files changed
+308 -75

No files matched your search

+18 -5
View File
@@ -1,16 +1,17 @@
<template> <template>
<div class="main-warpper"> <div class="main-wrapper">
<miao-header></miao-header> <miao-header></miao-header>
<miao-content-warpper> <miao-content-wrapper>
<NuxtPage /> <NuxtPage />
</miao-content-warpper> </miao-content-wrapper>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import miaoHeader from './components/miaoHeader.vue'; import miaoHeader from './components/miaoHeader.vue';
import miaoContentWarpper from './components/miaoContentWarpper.vue'; import miaoContentWrapper from './components/miaoContentWrapper.vue';
// @ts-ignore
useHead({ useHead({
title: '杪 Blog', title: '杪 Blog',
meta: [ meta: [
@@ -21,7 +22,7 @@ useHead({
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main-warpper { .main-wrapper {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
display: flex; display: flex;
@@ -32,3 +33,15 @@ useHead({
<style lang="scss"> <style lang="scss">
@use '/style/default.scss'; @use '/style/default.scss';
</style> </style>
<style>
.page-enter-active,
.page-leave-active {
transition: all 0.15s ease;
}
.page-enter-from,
.page-leave-to {
opacity: 0;
filter: blur(1rem);
}
</style>
@@ -1,7 +1,7 @@
<template> <template>
<main id="miao-main"> <main id="miao-main">
<n-scrollbar> <n-scrollbar>
<div class="miao-main-slot-warpper"> <div class="miao-main-slot-wrapper">
<slot></slot> <slot></slot>
</div> </div>
</n-scrollbar> </n-scrollbar>
@@ -20,7 +20,7 @@
padding: 0; padding: 0;
box-sizing: border-box; box-sizing: border-box;
.miao-main-slot-warpper { .miao-main-slot-wrapper {
position: relative; position: relative;
min-height: calc(100vh - 60px); min-height: calc(100vh - 60px);
} }
+7 -6
View File
@@ -1,11 +1,11 @@
<template> <template>
<section id="miao-header-warpper"> <section id="miao-header-wrapper">
<header id="miao-header"> <header id="miao-header">
<div class="miao-header-title"> <div class="miao-header-title">
<a href="https://nj.miaospring.top:3001/" target="_blank" title="喵"><span <a href="https://nj.miaospring.top:3001/" target="_blank" title="喵"><span
style="color: #15aa87; margin-right: 1px;">杪</span>Blog</a> style="color: #15aa87; margin-right: 1px;">杪</span>Blog</a>
</div> </div>
<div class="header-right-warp"> <div class="header-right-wrap">
<ul class="miao-header-nav"> <ul class="miao-header-nav">
<li v-for="(item) in navList" :key="item.path" <li v-for="(item) in navList" :key="item.path"
:class="['miao-header-nav-item', isActive(item) ? 'miao-header-nav-item-active' : '']"> :class="['miao-header-nav-item', isActive(item) ? 'miao-header-nav-item-active' : '']">
@@ -57,8 +57,9 @@ const isActive = (navItem: NavItem) => {
return false return false
} }
onMounted(() => { onMounted(async () => {
// console.log(route) // const data = await $fetch('/api/test')
// console.log(data)
}) })
</script> </script>
@@ -66,7 +67,7 @@ onMounted(() => {
// @use '/style/miaoStyle.scss'; // @use '/style/miaoStyle.scss';
#miao-header-warpper { #miao-header-wrapper {
position: relative; position: relative;
background-color: #fff; background-color: #fff;
user-select: none; user-select: none;
@@ -102,7 +103,7 @@ onMounted(() => {
} }
} }
.header-right-warp { .header-right-wrap {
flex: 1; flex: 1;
height: 100%; height: 100%;
margin-left: auto; margin-left: auto;
+32 -21
View File
@@ -5,25 +5,36 @@ import Components from "unplugin-vue-components/vite";
// https://nuxt.com/docs/api/configuration/nuxt-config // https://nuxt.com/docs/api/configuration/nuxt-config
// @ts-ignore // @ts-ignore
export default defineNuxtConfig({ export default defineNuxtConfig({
devtools: { enabled: true }, devtools: { enabled: false },
alias: { alias: {
"@": "/" "@": "/"
}, },
vite: { app: {
server: {}, pageTransition: {
plugins: [ name: 'page',
AutoImport({ mode: 'out-in'
imports: [ }
{ },
"naive-ui": ["useDialog", "useMessage", "useNotification", "useLoadingBar"] vite: {
} server: {},
] plugins: [
}), AutoImport({
Components({ imports: [
resolvers: [NaiveUiResolver()] {
}) "naive-ui": ["useDialog", "useMessage", "useNotification", "useLoadingBar"]
] }
}, ]
modules: ["nuxtjs-naive-ui", "@pinia/nuxt"], }),
compatibilityDate: "2025-01-12" Components({
resolvers: [NaiveUiResolver()]
})
]
},
modules: ["nuxtjs-naive-ui", "@pinia/nuxt"],
compatibilityDate: "2025-01-12",
build: {
// 开启打包分析
analyze: true,
},
experimental: { appManifest: false },
}); });
+39 -29
View File
@@ -3,22 +3,24 @@
<div class="title"> <div class="title">
<span>导航</span> <span>导航</span>
</div> </div>
<div class="content-warp"> <div class="content-wrap">
<div v-for="(item) in PageContent" :key="item.subTitle" class="content"> <div v-for="(item) in PageContent" :key="item.subTitle" class="content">
<div class="sub-title"> <div class="sub-title">
<n-divider title-placement="left"> <n-divider title-placement="left">
<div class="sub-title-text">{{ item.subTitle }}</div> <div class="sub-title-wrapper">
<div :class="['sub-title-chevron', item.show ? '' : 'sub-title-chevron-hide']" <div class="sub-title-text">{{ item.subTitle }}</div>
@click="switchItemShow(item)"> <div :class="['sub-title-chevron', item.show ? '' : 'sub-title-chevron-hide']"
<ChevronDown /> @click="switchItemShow(item)">
<ChevronDown />
</div>
</div> </div>
</n-divider> </n-divider>
</div> </div>
<div :class="['content-items-warp', item.show ? '' : 'content-items-warp-hide']"> <div :class="['content-items-wrap', item.show ? '' : 'content-items-wrap-hide']">
<div v-for="(cItem) in item.content" :key="cItem.name" class="content-item"> <div v-for="(cItem) in item.content" :key="cItem.name" class="content-item">
<div class="content-item-name">{{ cItem.name }}</div> <div class="content-item-name">{{ cItem.name }}</div>
<div class="content-item-description">{{ cItem.description }}</div> <div class="content-item-description">{{ cItem.description }}</div>
<div class="content-item-link-warp"> <div class="content-item-link-wrap">
<div>link:</div> <div>link:</div>
<a v-for="link in (cItem.links ?? [])" :href="link.url" target="_blank">{{ link.name }}</a> <a v-for="link in (cItem.links ?? [])" :href="link.url" target="_blank">{{ link.name }}</a>
<NuxtLink v-for="link in (cItem.nuxtLinks ?? [])" :to="link.to">{{ link.name }}</NuxtLink> <NuxtLink v-for="link in (cItem.nuxtLinks ?? [])" :to="link.to">{{ link.name }}</NuxtLink>
@@ -93,6 +95,21 @@ const PageContent = reactive<PageContent[]>([
] ]
} }
] ]
}, {
subTitle: '小工具',
show: true,
content: [
{
name: 'genshin-gacha',
description: '通过模拟来计算抽卡成功率的小工具',
nuxtLinks: [
{
name: 'demo',
to: 'tool/genshin-gacha'
}
]
},
]
}, { }, {
subTitle: '学习资料', subTitle: '学习资料',
show: true, show: true,
@@ -109,22 +126,7 @@ const PageContent = reactive<PageContent[]>([
] ]
}, },
] ]
}, { },
subTitle: '小工具',
show: true,
content: [
{
name: 'genshin-gacha',
description: '通过模拟来计算抽卡成功率的小工具',
nuxtLinks: [
{
name: 'demo',
to: 'tool/genshin-gacha'
}
]
},
]
}
]) ])
const switchItemShow = (item: PageContent) => { const switchItemShow = (item: PageContent) => {
@@ -140,14 +142,13 @@ const switchItemShow = (item: PageContent) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.main { .main {
box-sizing: border-box; box-sizing: border-box;
// min-height: calc(100vh - 60px);
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 20px 10px; padding: 20px 10px;
background: rgba(21, 170, 135, .02); background: rgba(21, 170, 135, .02);
.content-warp { .content-wrap {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
padding: 0 15px; padding: 0 15px;
@@ -156,10 +157,17 @@ const switchItemShow = (item: PageContent) => {
.sub-title { .sub-title {
display: flex; display: flex;
height: 80px;
margin-bottom: 10px; margin-bottom: 10px;
letter-spacing: 2px; letter-spacing: 2px;
user-select: none; user-select: none;
.sub-title-wrapper {
height: 80px;
display: flex;
align-items: center;
}
.sub-title-text { .sub-title-text {
font-size: 20px; font-size: 20px;
// font-weight: 500; // font-weight: 500;
@@ -193,14 +201,14 @@ const switchItemShow = (item: PageContent) => {
} }
} }
.content-items-warp { .content-items-wrap {
max-height: 200vh; max-height: 400vh;
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
justify-content: center; justify-content: center;
gap: 20px; gap: 20px;
// overflow: hidden; // overflow: hidden;
transition: max-height 0.25s ease, opacity 0.3s ease; transition: max-height 0.25s ease, opacity 0.25s ease;
opacity: 1; opacity: 1;
// margin: 0 -20px; // margin: 0 -20px;
@@ -248,9 +256,10 @@ const switchItemShow = (item: PageContent) => {
font-size: 14px; font-size: 14px;
font-weight: 300; font-weight: 300;
padding: 0 10px; padding: 0 10px;
min-height: 40px;
} }
.content-item-link-warp { .content-item-link-wrap {
flex: 1; flex: 1;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
@@ -291,6 +300,7 @@ const switchItemShow = (item: PageContent) => {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
user-select: none;
// margin-bottom: 10px; // margin-bottom: 10px;
&>span { &>span {
+7 -6
View File
@@ -1,6 +1,6 @@
<template> <template>
<div class="temp"> <div class="post-wrapper">
其实<br>一篇文章都还没写 <NuxtPage />
</div> </div>
</template> </template>
@@ -9,12 +9,13 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.temp { .post-wrapper {
height: calc(100vh - 60px);
display: flex; display: flex;
flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 35px; margin: 0 auto;
font-family: PT Serif, Serif; max-width: 800px;
padding: 0;
} }
</style> </style>
+119
View File
@@ -0,0 +1,119 @@
<template>
<div class="posts-wrapper">
<article class="posts-item" v-for="post in postsData" :key="post.id">
<header class="post-title">
<a href="">{{ post.title }}</a>
</header>
<p class="post-summary">{{ post.summary }}...</p>
<footer class="post-footer">
<div class="post-date">{{ post.date }}</div>
<div class="post-tags">
<div v-for="tag in post.tags">{{ tag }}</div>
</div>
</footer>
</article>
<div class="posts-skeleton" v-if="!isInit">
<div class="posts-skeleton-item" v-for="_ in range(5)">
<n-skeleton text style="height: 40px; width: 60%" />
<n-skeleton text :repeat="2" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import type { postItem } from '~/types/post';
// const router = useRouter()
const isInit = ref(false)
const postsData = ref<postItem[]>([])
onMounted(async () => {
// router.push('/posts/temp')
await sleep(1000)
postsData.value = await $fetch('/api/posts/getPosts')
isInit.value = true
console.log(postsData.value)
})
</script>
<style lang="scss" scoped>
.posts-wrapper {
// height: 50vh;
width: 100%;
padding-top: 10px;
// background-color: #15aa87;
.posts-item {
margin: 10px 20px;
padding-bottom: 20px;
&:not(:last-child) {
border-bottom: 1px solid #e8e8e8;
}
.post-title {
font-family: PT Serif, Serif;
font-size: 28px;
border-bottom: 0;
&>a {
cursor: pointer;
color: #000;
transition: all .2s;
text-decoration: none;
&:hover {
color: #15aa87;
}
}
}
.post-summary {
font-size: 14px;
color: rgba(0, 0, 0, .54);
font-weight: 200;
}
.post-footer {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10px;
font-size: 12px;
color: rgba(0, 0, 0, .54);
font-weight: 200;
.post-date {
font-size: 12px;
}
.post-tags {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
font-size: 12px;
color: rgba(0, 0, 0, .54);
font-weight: 200;
&>div {
cursor: pointer;
transition: color .2s linear;
&:hover {
color: #15aa87;
}
}
}
}
}
.posts-skeleton {
&-item {
padding: 10px 20px;
}
}
}
</style>
+21
View File
@@ -0,0 +1,21 @@
<template>
<div class="temp">
其实<br>一篇文章都还没写
<NuxtPage />
</div>
</template>
<script setup lang="ts">
</script>
<style lang="scss" scoped>
.temp {
height: calc(100vh - 60px);
display: flex;
justify-content: center;
align-items: center;
font-size: 35px;
font-family: PT Serif, Serif;
}
</style>
+2 -2
View File
@@ -1,5 +1,5 @@
<template> <template>
<div class="iframe-warpper"> <div class="iframe-wrapper">
<iframe src="/iframe-source/genshin-gacha/index.html" frameborder="0"></iframe> <iframe src="/iframe-source/genshin-gacha/index.html" frameborder="0"></iframe>
</div> </div>
</template> </template>
@@ -9,7 +9,7 @@
</script> </script>
<style scoped> <style scoped>
.iframe-warpper { .iframe-wrapper {
width: 100%; width: 100%;
min-height: inherit; min-height: inherit;
padding: 0; padding: 0;
+22
View File
@@ -0,0 +1,22 @@
import type { postItem } from "~/types/post";
function generateFakeData(length: number) {
const data: postItem[] = [];
for (let i = 0; i < length; i++) {
data.push({
id: i,
title: `测试标题`,
summary: `测试摘要测试摘要测试摘要测试摘要测试摘要测试摘要测试摘要测试摘要测试摘要测试摘要测试摘要`,
type: 'markdown',
tags: ['test', 'test1'],
url: '',
date: parseInt(new Date().getTime().toFixed()),
});
}
return data;
}
export default defineEventHandler((event) => {
const data = generateFakeData(50)
return data
})
+5
View File
@@ -0,0 +1,5 @@
export default defineEventHandler((event) => {
return {
hello: 'world'
}
})
+9 -4
View File
@@ -1,9 +1,14 @@
{ {
// https://nuxt.com/docs/guide/concepts/typescript // https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json", "extends": "./.nuxt/tsconfig.json",
"exclude": [ "include": [
".output", "pages/**/*",
"node_modules", "hooks/**/*",
".nuxt", "components/**/*",
"server/**/*",
"style/**/*",
"utils/**/*",
".nuxt/**/*",
"types/**/*"
] ]
} }
+9
View File
@@ -0,0 +1,9 @@
export type postItem = {
id: number;
title: string;
date: number;
summary: string;
tags: string[];
type: 'markdown';
url: string;
};
+11
View File
@@ -0,0 +1,11 @@
export default function range(start: number, end?: number) {
if (end === undefined) {
end = start;
start = 0;
}
const result = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
}
+5
View File
@@ -0,0 +1,5 @@
export default function sleep(time: number) {
return new Promise((resolve) => {
setTimeout(resolve, time)
})
}