Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
onresize committed Apr 6, 2024
1 parent 81c0bbd commit 1ae1c66
Show file tree
Hide file tree
Showing 16 changed files with 665 additions and 39 deletions.
17 changes: 13 additions & 4 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import path from 'path'
import { defaultTheme } from '@vuepress/theme-default'
import { defineUserConfig } from 'vuepress'
import { searchPlugin } from '@vuepress/plugin-search'
import viteCompression from "vite-plugin-compression";
import navbar from './config/navbar'
import sidebar from './config/silder'

Expand Down Expand Up @@ -55,7 +56,7 @@ export default defineUserConfig({
[
'link',
{
rel: 'preload',
rel: 'prefetch',
href: 'https://onresize.github.io/react-ts-vite-admin/SandPack',
as: 'document',
},
Expand Down Expand Up @@ -138,13 +139,21 @@ export default defineUserConfig({
navbar,
sidebar,

editLink: false, // 是否启用 编辑此页 链接
editLink: true, // 是否启用 编辑此页 链接
editLinkText: '在 GitHub 上编辑此页',
}),

plugins: [
searchPlugin({
// 排除首页
isSearchable: (page) => page.path !== '/',
isSearchable: (page) => page.path !== '/', // 排除首页
}),
viteCompression({
verbose: true,
disable: false, // 不禁用压缩
deleteOriginFile: false, // 压缩后是否删除原文件
threshold: 10240, // 文件小于 10kb 不进行压缩
algorithm: "gzip", // 压缩算法
ext: ".gz" // 文件类型
}),
],
})
3 changes: 2 additions & 1 deletion docs/.vuepress/config/silder.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export default [
'/技术总结/踩坑总结/HTTP',
'/技术总结/踩坑总结/如何检测网页http版本',
'/技术总结/踩坑总结/referrer',
'/技术总结/踩坑总结/前端缓存',
'/技术总结/踩坑总结/http缓存',
'/技术总结/踩坑总结/worker',
'/技术总结/踩坑总结/浏览器跨页面,跨窗口通信',
'/技术总结/踩坑总结/跨域相关',
'/技术总结/踩坑总结/web端扫码的几种方案',
'/技术总结/踩坑总结/vite.config.js常用配置',
Expand Down
58 changes: 42 additions & 16 deletions docs/.vuepress/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { Popper, PopperShape, MAX_Z_INDEX } from '@moefy-canvas/theme-popper'
import { Sakura } from '@moefy-canvas/theme-sakura'
import Fps from '../components/Fps.vue'
import { devDependencies } from '../../../package.json'
import autoWriting from '../utils/print'
console.log(`%cVuePress%c${devDependencies.vuepress}`, 'padding: 3px; color: white; background: #023047; border-radius: 5px 0 0 5px;', 'padding: 3px; color: white; background: #219EBC;border-radius: 0 5px 5px 0;')
const state = reactive({
showPageBottom: true,
onLinNum: 0
onLinNum: 0,
showHeaderNavBar: true,
})
const themeConfig = {
Expand Down Expand Up @@ -59,10 +61,29 @@ loadPopper()
const route = useRoute()
let routerPathArr = [encodeURI('/工作效率/HTML概览.html'), encodeURI('/工作效率/CSS概览.html')]
watch(() => route.path, async (val) => {
// console.log('监听route:', route)
// console.log('监听route.path:', val)
await nextTick()
loadScript('/web-blogs/static/js/busuanzi.pure.mini.js') // 加载计数统计脚本
state.showPageBottom = routerPathArr.includes(val) ? false : true
if (val === '/') {
state.showHeaderNavBar = true
} else {
state.showHeaderNavBar = false
}
},
{
flush: 'post',
deep: true,
immediate: true
})
watch(() => route, async (to, from) => {
// console.log('路由信息:', from)
await nextTick()
if (!from || from.path === '/') {
autoWriting()
}
},
{
flush: 'post',
Expand All @@ -71,6 +92,7 @@ watch(() => route.path, async (val) => {
})
onMounted(() => { })
onUnmounted(() => {
Expand All @@ -89,6 +111,10 @@ onUnmounted(() => {
<Fps v-show="state.showPageBottom" />
<ParentLayout>
<template #navbar>
<div v-if="state.showHeaderNavBar"></div>
</template>
<template #page-bottom v-if="state.showPageBottom">
<div class="my-footer">
<!-- RSS -->
Expand All @@ -110,7 +136,7 @@ onUnmounted(() => {
.my-footer {
text-align: center;
width: 740px;
width: var(--content-width);
height: 80px;
margin: 10px auto;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.05);
Expand All @@ -121,23 +147,23 @@ onUnmounted(() => {
flex-wrap: wrap;
align-content: center;
.icon-rss {
width: 30px;
height: 30px;
display: inline-block;
background: url('/RSS.png') no-repeat center center;
background-size: 100% 100%;
transition: .3s;
&:hover {
filter: drop-shadow(1rem 1rem 100px #3EAF7C);
}
}
.visit-text {
color: #ADBAC7;
font-family: 'QT' !important;
font-weight: bold !important;
}
}
.icon-rss {
width: 30px;
height: 30px;
display: inline-block;
background: url('/RSS.png') no-repeat center center;
background-size: 100% 100%;
transition: .3s;
&:hover {
filter: drop-shadow(1rem 1rem 100px #3EAF7C);
}
}
</style>
Binary file added docs/.vuepress/public/AA_mdPics/hc1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.vuepress/public/bg-heading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/.vuepress/public/icon/mouse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions docs/.vuepress/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:root {
scroll-behavior: smooth;
--content-width: 930px;
--back-to-top-icon: url(/icon/mouse.svg)
}

.AnLi {
Expand Down Expand Up @@ -40,3 +41,12 @@ img {
font-weight: bold;
font-family: '楷体';
}

.red-txt {
color: red;
border-radius: 5px;
padding: 0 5px;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
// border: 1px solid #e4e7ed;
// background-color: #ffffff;
}
98 changes: 98 additions & 0 deletions docs/.vuepress/utils/print.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// (function(root, factory){
// if(typeof define === 'function' && define.amd){
// define([], factory);
// }else{
// root.Printer = factory(root);
// }
// }(this, function(root){
// var Printer = {};
// Printer.printer = {"version": "0.0.1"};
// var init_options = {
// "speed" : 50, //文字的速度
// "selector" : 'canvas', //要打印到的标签的ID
// "startIndex" : 0, //从第几个字符开始打印
// "endIndex" : 0, //打印到第几个字符结束
// "hasCur" : true, //是否有光标
// "curId" : 'cur', //光标的ID
// "curStr" : '_', //光标字符
// "curStyle" : 'font-weight: bold;', //光标的样式(CSS样式)
// "curSpeed" : 100, //光标的速度(ms)
// "lnStr": ""
// };



// var str = "", options = init_options;
// var flwCurTimer, dom, curObj, reStr='', curSwitch,index=0;

// Printer.init = function(arg_str, arg_options){
// str = arg_str;
// for( var option in arg_options ){
// options[option] = arg_options[option];
// }
// dom = document.getElementById(options.selector);
// index = options.startIndex;
// options.endIndex = options.endIndex == 0 ? str.length : options.endIndex
// options.hasCur && flwCur();
// return this;
// }


// Printer.print = function(){ //打印函数
// for(var i=0; i<str.length; i++) {
// (function(index){
// setTimeout(function(){
// if (str.charAt(index) === '\n'){
// reStr += '<br>' + options.lnStr;
// } else {
// reStr += str.charAt(index);
// }
// dom.innerHTML= options.lnStr + reStr
// }, options.speed * (index + 1))
// })(i);
// }

// setTimeout(function(){
// if(options.hasCur){
// var element = document.createElement("span");
// element.id = options.curId
// dom.appendChild(element);

// curObj = document.getElementById(options.curId);
// clearTimeout(flwCurTimer);
// setInterval(chCur, options.curSpeed);
// }
// }, options.speed * str.length)
// }

// function flwCur(){ //跟随光标
// dom.innerHTML += '<span id="'+options.curId+'" style="'+options.curStyle+'">'+options.curStr+'</span>';
// flwCurTimer = setTimeout(flwCur, 1.5 * options.speed);
// }

// function chCur(){ //闪烁光标
// curObj.innerHTML = curSwitch ? options.curStr : "";
// curSwitch = !curSwitch
// }

// return Printer;
// }));


// var str = 'itclanCoder\n';
// Printer.init(str, {
// selector: 'main-title',
// lnStr: 'root@itclanCoder ~/ # '
// }).print();

const autoWriting = (index = 0) => {
let str = 'Hi there 👋, Welcome to my blog!'
const dom = document.getElementById('main-title')
let ret = ''
if (index < str.length) {
ret += str[index]
dom.innerHTML += ret
setTimeout(autoWriting, 80, ++index)
}
}
export default autoWriting
50 changes: 47 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
home: true
# title: Home
# heroText: BLOGS
title: null
heroText: .
heroImage: /image.png
tagline: 💻学习📝记录🔗分享
actions:
Expand All @@ -15,4 +15,48 @@ features:
- title: 高性能⭐️
details: vuePress2.0 为每个页面预渲染生成静态的 HTML,同时在页面被加载的时候,将作为 SPA 运行。
footer: null
---
---

<div class="home-bg-container">
<div class="home-bg"></div>
</div>

<style>
body {
background: transparent !important;
}

.home .features {
border-top: 1px solid #eaecef !important;
}

.home-bg-container {
position: fixed;
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
pointer-events: none;
}

.home-bg {
width: 100%;
height: 100%;
object-fit: cover;
}

.home-bg:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('/bg-heading.png') repeat;
background-size: auto;
/* background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z+AAAABmJLR0QA/wD/A+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAKUlEQVQImU3IMREAIAgAwJfNkQCEsH8cijjpMf6vnXlQaIiJF+omEBfmqIEZLe2jzcAAAAASUVORK5CYII=); */

}
</style>
Loading

0 comments on commit 1ae1c66

Please sign in to comment.