8 changed files with 178 additions and 10 deletions
-
6package-lock.json
-
1package.json
-
7src/App.vue
-
1src/components/admin/MainWrapper.vue
-
134src/components/blogs/HomePage.vue
-
32src/components/blogs/ceshi.vue
-
5src/router/home.ts
-
2src/types/custom.d.ts
@ -1,11 +1,131 @@ |
|||
<template> |
|||
<div>ceshi</div> |
|||
<Simplebar style="height: 100vh;overflow: auto;" @scroll="handleScroll"> |
|||
<div class="menu" v-if="show_menu"> |
|||
<a-menu v-model:selectedKeys="current" mode="horizontal" :items="items" style="border-bottom: none;" /> |
|||
<a-input-search v-model:value="value" placeholder="search" style="width: 200px" @search="onSearch" /> |
|||
</div> |
|||
<div class="carouse"> |
|||
<a-carousel autoplay> |
|||
<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/nav13.png" alt=""></div> |
|||
</a-carousel> |
|||
|
|||
</div> |
|||
</Simplebar> |
|||
</template> |
|||
|
|||
<script setup lang='ts'> |
|||
|
|||
<script lang="ts" setup> |
|||
import Simplebar from 'simplebar-vue'; |
|||
import 'simplebar-vue/dist/simplebar.min.css'; |
|||
import { h, ref } from 'vue'; |
|||
import { MenuProps } from 'ant-design-vue/es/menu'; |
|||
import { HomeOutlined, HighlightOutlined, ProfileOutlined, CameraOutlined, UsergroupDeleteOutlined } from '@ant-design/icons-vue'; |
|||
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 items = ref<MenuProps['items']>([ |
|||
{ |
|||
key: 'home', |
|||
icon: () => h(HomeOutlined), |
|||
label: '首页', |
|||
title: '首页', |
|||
}, |
|||
{ |
|||
key: 'blog', |
|||
icon: () => h(HighlightOutlined), |
|||
label: '博客', |
|||
title: '博客', |
|||
}, |
|||
{ |
|||
key: 'diary', |
|||
icon: () => h(ProfileOutlined), |
|||
label: '日记', |
|||
title: '日记', |
|||
}, |
|||
{ |
|||
key: 'album', |
|||
icon: () => h(CameraOutlined), |
|||
label: '相册', |
|||
title: '相册', |
|||
children: [ |
|||
{ |
|||
label: '相册1', |
|||
key: 'album1', |
|||
}, |
|||
{ |
|||
label: '相册2', |
|||
key: 'album2', |
|||
}, |
|||
{ |
|||
label: '相册3', |
|||
key: 'album3', |
|||
}, |
|||
{ |
|||
label: '相册4', |
|||
key: 'album4', |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
key: 'aboutme', |
|||
icon: () => h(UsergroupDeleteOutlined), |
|||
label: '关于sunfree', |
|||
title: '关于sunfree', |
|||
}, |
|||
]); |
|||
const value = ref<string>(''); |
|||
const onSearch = (searchValue: string) => { |
|||
console.log('use value', searchValue); |
|||
console.log('or use this.value', value.value); |
|||
}; |
|||
|
|||
|
|||
</script> |
|||
|
|||
<style> |
|||
|
|||
<style scoped> |
|||
.menu { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
padding: 10px 0; |
|||
width: 100%; |
|||
border-bottom: 1px solid rgba(5, 5, 5, 0.06); |
|||
position: fixed; |
|||
background-color: white; |
|||
transform: translateX(-50%); |
|||
top: 0; |
|||
left: 50%; |
|||
z-index: 999; |
|||
} |
|||
|
|||
.menu>* { |
|||
margin: 0 24px; |
|||
} |
|||
|
|||
:deep(.slick-slide) { |
|||
text-align: center; |
|||
height: 100vh; |
|||
line-height: 160px; |
|||
background: #364d79; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
:deep(.slick-slide h3) { |
|||
color: #fff; |
|||
} |
|||
|
|||
button { |
|||
position: absolute; |
|||
bottom: 100px; |
|||
left: 50%; |
|||
transform: translateX(-50%); |
|||
} |
|||
|
|||
|
|||
</style> |
@ -0,0 +1,32 @@ |
|||
<template> |
|||
<div ref="animeRef" style="font-size: 36px;">你石头很大的朱</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import anime from 'animejs'; |
|||
|
|||
export default { |
|||
mounted() { |
|||
const textWrapper = this.$refs.animeRef; |
|||
textWrapper.innerHTML = textWrapper.textContent.replace(/\S/g, "<span class='letter'>$&</span>"); |
|||
|
|||
anime.timeline({loop: false}) |
|||
.add({ |
|||
targets: '.letter', |
|||
scale: [4,1], |
|||
opacity: [0,1], |
|||
translateZ: 0, |
|||
easing: "easeOutExpo", |
|||
duration: 950, |
|||
delay: (el, i) => 70*i |
|||
}); |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.letter { |
|||
display: inline-block; |
|||
line-height: 1em; |
|||
} |
|||
</style> |
@ -1,2 +1,4 @@ |
|||
declare module 'ant-design-vue'; |
|||
declare module 'echarts'; |
|||
declare module 'ant-design-vue/es/menu' |
|||
declare module 'animejs/lib/anime.es.js' |
Write
Preview
Loading…
Cancel
Save
Reference in new issue