@ -2,13 +2,14 @@
< Simplebar @scroll ="handleScroll" >
< Simplebar @scroll ="handleScroll" >
<!-- 头部导航菜单 -- >
<!-- 头部导航菜单 -- >
< div class = "headerMenu" v-if ="show_menu" >
< div class = "headerMenu" v-if ="show_menu" >
< a -menu v -model :selectedKeys ="current" mode = "horizontal" :items ="items" style = "border-bottom: none;" / >
< a -menu v -model :selectedKeys ="current" mode = "horizontal" :items ="items" style = "border-bottom: none;"
@ click = "menuClick" / >
< a -input -search v -model :value ="value" placeholder = "search" style = "width: 200px" @search ="onSearch" / >
< a -input -search v -model :value ="value" placeholder = "search" style = "width: 200px" @search ="onSearch" / >
< / div >
< / div >
< div class = "author" > < / div >
< div class = "author" v-if ="show_author" > < / div >
<!-- 轮播 -- >
<!-- 轮播 -- >
< div >
< div v-if ="show_carousel" >
< a -carousel autoplay >
< a -carousel autoplay >
< div class = "img" > < img src = "/src/assets/images/nav1.png" alt = "" > < / div >
< div class = "img" > < img src = "/src/assets/images/nav1.png" alt = "" > < / div >
< div class = "img" > < img src = "/src/assets/images/nav10.png" alt = "" > < / div >
< div class = "img" > < img src = "/src/assets/images/nav10.png" alt = "" > < / div >
@ -73,55 +74,18 @@
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< a -button type = "dashed" > Link < / a - b u t t o n >
< / div >
< / div >
< / a - c a r d >
< / a - c a r d >
< / div >
< / div >
< RouterView / >
< div class = "main" >
< a -badge -ribbon text = "Hippies" color = "black" >
< a -card hoverable >
< h2 > 操作系统的安装 < / h2 >
< div class = "tag-group" >
< a -tag color = "#E6E6FA" >
< template # icon >
< RiLiLined / >
< / template >
{ { mainStatistic . mainDate } }
< / a - t a g >
< a -tag color = "#6495ED" >
< template # icon >
< YanJingLined / >
< / template >
{ { mainStatistic . mainWatchCount } }
< / a - t a g >
< a -tag color = "#B0C4DE" >
< template # icon >
< XieZiLined / >
< / template >
字数 ≈ { { mainStatistic . mainWordCount } } 字
< / a - t a g >
< a -tag color = "#20B2AA" >
< template # icon >
< YueDuLined / >
< / template >
阅读时长 ≈ { { mainStatistic . mainReadCount } } 分
< / a - t a g >
< / div >
< div class = "blog-content" >
< div >
< a -image :preview ="false" :width ="200"
src = "https://cdn.naccl.top/blog/blogHosting/2024/02/B01/f56c5bbe-469c-4eb7-a994-9281d6eed689.png" / >
< / div >
< span style = "height: 160px" > 测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试 < / span >
< / div >
< div class = "read-button" >
< a -button type = "primary" shape = "round" > 阅读全文 < / a - b u t t o n >
< / div >
< / a - c a r d >
< / a - b a d g e - r i b b o n >
< / div >
< div class = "rightBar" >
< div class = "rightBar" >
< a -card hoverable style = "width: 400px;" >
< a -card hoverable style = "width: 400px;" >
< template # cover >
< template # cover >
@ -157,12 +121,12 @@
< / Simplebar >
< / Simplebar >
< / template >
< / template >
< script lang = "ts" setup >
< script lang = "ts" setup >
import { h , reactive , ref } from 'vue' ;
import { h , reactive , ref , nextTick } from 'vue' ;
import { MenuProps } from 'ant-design-vue/es/menu' ;
import { MenuProps } from 'ant-design-vue/es/menu' ;
import { HomeOutlined , HighlightOutlined , ProfileOutlined , CameraOutlined , UsergroupDeleteOutlined , DownCircleOutlined } from '@ant-design/icons-vue' ;
import { HomeOutlined , HighlightOutlined , ProfileOutlined , CameraOutlined , UsergroupDeleteOutlined , DownCircleOutlined } from '@ant-design/icons-vue' ;
import { MusicLined , EmailLined , QQLined , WechatLined , GravatarLined , GitHubLined } from "@/assets"
import { MusicLined , EmailLined , QQLined , WechatLined , GravatarLined , GitHubLined } from "@/assets"
import Typed from 'typed.js' ;
import Typed from 'typed.js' ;
import { onMounted } from 'vue' ;
import { onMounted , watch } from 'vue' ;
import type { CSSProperties } from 'vue' ;
import type { CSSProperties } from 'vue' ;
import { CaretRightOutlined } from '@ant-design/icons-vue' ;
import { CaretRightOutlined } from '@ant-design/icons-vue' ;
import 'APlayer/dist/APlayer.min.css' ;
import 'APlayer/dist/APlayer.min.css' ;
@ -170,9 +134,10 @@ import APlayer from 'APlayer';
import { createEcharts } from "@/hooks/intex"
import { createEcharts } from "@/hooks/intex"
import { SettingOutlined , EditOutlined , EllipsisOutlined } from '@ant-design/icons-vue' ;
import { SettingOutlined , EditOutlined , EllipsisOutlined } from '@ant-design/icons-vue' ;
import { RiLiLined , YueDuLined , YanJingLined , XieZiLined } from '@/assets' ;
import { RiLiLined , YueDuLined , YanJingLined , XieZiLined } from '@/assets' ;
import { useRouter } from 'vue-router' ;
import { useRouter , useRoute } from 'vue-router' ;
const random = ref ( ) ;
const random = ref ( ) ;
const router = useRouter ( )
const router = useRouter ( )
const route = useRoute ( )
const heat = ref ( null ) ;
const heat = ref ( null ) ;
const activeKey = ref ( [ '' ] ) ;
const activeKey = ref ( [ '' ] ) ;
const text = ` A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world. ` ;
const text = ` A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world. ` ;
@ -328,58 +293,32 @@ onMounted(() => {
createEcharts ( heat , heatMapData ) ;
createEcharts ( heat , heatMapData ) ;
} )
} )
const current = ref < string [ ] > ( [ 'mail' ] ) ;
const show_menu = ref ( false ) ;
/ / 定 义 滚 动 条 滚 到 一 半 显 示 导 航 菜 单
const handleScroll = ( ) => {
const scrollbar = document . querySelector ( '.simplebar-content-wrapper' ) ;
if ( scrollbar ) {
const scrollOffset = scrollbar . scrollTop ;
const halfViewportHeight = scrollbar . clientHeight / 2 ;
show_menu . value = scrollOffset > halfViewportHeight ;
}
} ;
/ / 点 击 按 钮 , 实 现 滚 动 到 视 窗 高 度 距 离 , 如 果 已 经 滚 动 , 只 需 要 滚 动 视 窗 高 度 - 已 经 滚 动 的 距 离
const downScroll = ( ) => {
const scrollbar = document . querySelector ( '.simplebar-content-wrapper' ) ;
if ( scrollbar ) {
const scrollTop = scrollbar . scrollTop ;
const viewportHeight = scrollbar . clientHeight ;
const scrollDistance = viewportHeight - scrollTop - 60 ;
setTimeout ( ( ) => {
scrollbar . scrollBy ( { top : scrollDistance , behavior : 'smooth' } ) ;
} , 300 ) ;
}
} ;
const mainStatistic = reactive < { mainDate : string , mainWatchCount : string , mainWordCount : string , mainReadCount : string } > ( {
mainDate : "2024-06-11" ,
mainWatchCount : "9999" ,
mainWordCount : "9999" ,
mainReadCount : "9999"
} )
/ / 导 航 菜 单
const show_menu = ref ( false ) ;
const show_carousel = ref ( true ) ;
const show_author = ref ( true )
const items = ref < MenuProps [ ' items ' ] > ( [
const items = ref < MenuProps [ ' items ' ] > ( [
{
{
key : 'home' ,
key : 'home' ,
icon : ( ) => h ( HomeOutlined ) ,
icon : ( ) => h ( HomeOutlined ) ,
label : '首页' ,
label : '首页' ,
title : '首页' ,
title : '首页' ,
url : '/'
} ,
} ,
{
{
key : 'blog' ,
key : 'blog' ,
icon : ( ) => h ( HighlightOutlined ) ,
icon : ( ) => h ( HighlightOutlined ) ,
label : '博客' ,
label : '博客' ,
title : '博客' ,
title : '博客' ,
url : "/blog"
} ,
} ,
{
{
key : 'diary' ,
key : 'diary' ,
icon : ( ) => h ( ProfileOutlined ) ,
icon : ( ) => h ( ProfileOutlined ) ,
label : '日记' ,
label : '日记' ,
title : '日记' ,
title : '日记' ,
url : '/diary'
} ,
} ,
{
{
key : 'album' ,
key : 'album' ,
@ -412,6 +351,50 @@ const items = ref<MenuProps['items']>([
title : '关于sunfree' ,
title : '关于sunfree' ,
} ,
} ,
] ) ;
] ) ;
const handleScrollEnabled = ref ( true ) ;
/ / 定 义 滚 动 条 滚 到 一 半 显 示 导 航 菜 单
const handleScroll = ( ) => {
if ( ! handleScrollEnabled . value ) return ;
const scrollbar = document . querySelector ( '.simplebar-content-wrapper' ) ;
if ( scrollbar ) {
const scrollOffset = scrollbar . scrollTop ;
const halfViewportHeight = scrollbar . clientHeight / 2 ;
show_menu . value = scrollOffset > halfViewportHeight ;
}
} ;
const menuClick = ( { item } : { items : any } ) => {
/ / i f ( i t e m . t i t l e ! = " 首 页 " ) {
show_menu . value = true ;
show_carousel . value = false ;
handleScrollEnabled . value = false ;
router . push ( item . url )
}
const current = ref < string [ ] > ( [ 'mail' ] ) ;
/ / 点 击 按 钮 , 实 现 滚 动 到 视 窗 高 度 距 离 , 如 果 已 经 滚 动 , 只 需 要 滚 动 视 窗 高 度 - 已 经 滚 动 的 距 离
const downScroll = ( ) => {
const scrollbar = document . querySelector ( '.simplebar-content-wrapper' ) ;
if ( scrollbar ) {
const scrollTop = scrollbar . scrollTop ;
const viewportHeight = scrollbar . clientHeight ;
const scrollDistance = viewportHeight - scrollTop + 48 + 48 ;
setTimeout ( ( ) => {
scrollbar . scrollBy ( { top : scrollDistance , behavior : 'smooth' } ) ;
} , 300 ) ;
}
} ;
/ / 定 义 文 章
/ / c o n s t a r t i c l e s = r e a c t i v e ( {
/ / i m g : " " ,
/ / } )
const value = ref < string > ( '' ) ;
const value = ref < string > ( '' ) ;
const onSearch = ( searchValue : string ) => {
const onSearch = ( searchValue : string ) => {
console . log ( 'use value' , searchValue ) ;
console . log ( 'use value' , searchValue ) ;
@ -434,9 +417,8 @@ const gravatarClick = () => {
display : flex ;
display : flex ;
justify - content : center ;
justify - content : center ;
align - items : center ;
align - items : center ;
padding : 10 px 0 ;
width : 100 % ;
width : 100 % ;
padding : 0 24 px ;
height : 48 px ;
border - bottom : 1 px solid rgba ( 5 , 5 , 5 , 0.06 ) ;
border - bottom : 1 px solid rgba ( 5 , 5 , 5 , 0.06 ) ;
position : fixed ;
position : fixed ;
background - color : white ;
background - color : white ;
@ -446,9 +428,7 @@ const gravatarClick = () => {
z - index : 999 ;
z - index : 999 ;
}
}
. headerMenu > * {
margin : 0 24 px ;
}
/* 作者名称 */
/* 作者名称 */
. author {
. author {
@ -493,7 +473,7 @@ const gravatarClick = () => {
. mainContainer {
. mainContainer {
display : flex ;
display : flex ;
justify - content : center ;
justify - content : center ;
padding - top : 60 px ;
/* padding-top: 48px; */
background - color : rgba ( 5 , 5 , 5 , 0.08 ) ;
background - color : rgba ( 5 , 5 , 5 , 0.08 ) ;
}
}
@ -537,39 +517,6 @@ const gravatarClick = () => {
margin : 12 px ;
margin : 12 px ;
}
}
. main {
width : 45 % ;
margin : 0 24 px ;
}
. main h2 {
text - align : center ;
}
. main . tag - group {
display : flex ;
justify - content : center ;
}
. main . tag - group > * {
color : black ;
margin : 0 12 px ;
}
. main . blog - content {
display : flex ;
margin : 48 px ;
}
. main . blog - content > : nth - child ( 2 ) {
overflow : hidden ;
text - overflow : ellipsis ;
white - space : pre - wrap ; /* 防止文本换行 */
}
. main . read - button {
display : flex ;
justify - content : center ;
}
. rightBar {
. rightBar {
width : 20 % ;
width : 20 % ;
xxxxxxxxxx