mirror of https://github.com/YunYouJun/valaxy
fix: backToTop
This commit is contained in:
parent
280677941f
commit
00cc2b52ec
|
@ -21,7 +21,7 @@
|
|||
"devDependencies": {
|
||||
"nodemon": "^3.0.1",
|
||||
"vite": "^4.4.9",
|
||||
"vitepress": "1.0.0-rc.12",
|
||||
"vitepress": "1.0.0-rc.13",
|
||||
"vue": "^3.3.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,4 +113,4 @@ posts
|
|||
```
|
||||
|
||||
|
||||
:::
|
||||
:::
|
||||
|
|
|
@ -124,3 +124,13 @@ Here goes the body
|
|||
useScriptTag('https://static.codepen.io/assets/embed/ei.js')
|
||||
</script>
|
||||
```
|
||||
|
||||
## 强制规范
|
||||
|
||||
由于 Valaxy 支持解析 Vue 组件渲染,因此当您输入 `<CustomComponent></CustomComponent>` 时,它会解析 `components` 目录下的 `CustomComponent.vue` 组件并渲染。
|
||||
|
||||
当您不需要其被渲染时,请务必使用反引号包裹,如:
|
||||
|
||||
```md
|
||||
`<CustomComponent></CustomComponent>`
|
||||
```
|
||||
|
|
14
package.json
14
package.json
|
@ -45,18 +45,18 @@
|
|||
"prepare": "husky install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^0.41.0",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@antfu/eslint-config": "^0.42.0",
|
||||
"@microsoft/api-extractor": "^7.37.0",
|
||||
"@types/debug": "^4.1.8",
|
||||
"@types/markdown-it-attrs": "^4.1.0",
|
||||
"@types/markdown-it-container": "^2.0.6",
|
||||
"@types/markdown-it-emoji": "^2.0.2",
|
||||
"@types/node": "^20.6.0",
|
||||
"@types/node": "^20.6.1",
|
||||
"@types/prompts": "^2.4.4",
|
||||
"@types/resolve": "^1.20.2",
|
||||
"@types/semver": "^7.5.1",
|
||||
"@types/semver": "^7.5.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"cypress": "^13.1.0",
|
||||
"cypress": "^13.2.0",
|
||||
"eslint": "^8.49.0",
|
||||
"eslint-plugin-cypress": "^2.14.0",
|
||||
"https-localhost": "^4.7.1",
|
||||
|
@ -65,7 +65,7 @@
|
|||
"prompts": "^2.4.2",
|
||||
"rimraf": "^5.0.1",
|
||||
"tsup": "^7.2.0",
|
||||
"tsx": "^3.12.8",
|
||||
"tsx": "^3.12.10",
|
||||
"typescript": "^5.2.2",
|
||||
"valaxy": "workspace:*",
|
||||
"valaxy-addon-algolia": "workspace:*",
|
||||
|
@ -76,7 +76,7 @@
|
|||
"valaxy-theme-press": "workspace:*",
|
||||
"valaxy-theme-yun": "workspace:*",
|
||||
"vitest": "^0.34.4",
|
||||
"vue-tsc": "1.8.10",
|
||||
"vue-tsc": "1.8.11",
|
||||
"zx": "^7.2.3"
|
||||
},
|
||||
"pnpm": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { computed } from 'vue'
|
||||
import { useBackToTop } from 'valaxy'
|
||||
|
||||
const { show, percentage } = useBackToTop({ offset: 100 })
|
||||
const { show, percentage, backToTop } = useBackToTop({ offset: 100 })
|
||||
|
||||
const radius = 48
|
||||
const circumference = 2 * radius * Math.PI
|
||||
|
@ -15,7 +15,7 @@ const strokeOffset = computed(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<a href="#" class="back-to-top yun-icon-btn" :class="show && 'show'">
|
||||
<a href="#" class="back-to-top yun-icon-btn" :class="show && 'show'" @click="backToTop">
|
||||
<div w="8" h="8" i-ri-arrow-up-s-line />
|
||||
<svg class="progress-circle-container" viewBox="0 0 100 100">
|
||||
<circle :stroke-dasharray="`${circumference} ${circumference}`" :stroke-dashoffset="strokeOffset" class="progress-circle" cx="50" cy="50" :r="radius" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
|
||||
|
|
|
@ -27,8 +27,16 @@ export function useBackToTop(options: {
|
|||
|
||||
const show = computed(() => y.value > options.offset)
|
||||
|
||||
const backToTop = () => {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
percentage,
|
||||
show,
|
||||
backToTop,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
"@types/body-scroll-lock": "^3.1.0",
|
||||
"@vitejs/plugin-vue": "^4.3.4",
|
||||
"@vueuse/core": "^10.4.1",
|
||||
"@vueuse/head": "^1.3.1",
|
||||
"@vueuse/head": "^2.0.0",
|
||||
"@vueuse/integrations": "^10.4.1",
|
||||
"@vueuse/schema-org": "^2.2.0",
|
||||
"body-scroll-lock": "4.0.0-beta.0",
|
||||
|
@ -100,7 +100,7 @@
|
|||
"open": "8.4.2",
|
||||
"pascal-case": "^3.1.2",
|
||||
"pinia": "^2.1.6",
|
||||
"sass": "^1.66.1",
|
||||
"sass": "^1.67.0",
|
||||
"shiki": "^0.14.4",
|
||||
"star-markdown-css": "^0.4.2",
|
||||
"unconfig": "^0.3.10",
|
||||
|
@ -110,10 +110,10 @@
|
|||
"vite": "^4.4.9",
|
||||
"vite-plugin-pages": "^0.31.0",
|
||||
"vite-plugin-vue-layouts": "^0.8.0",
|
||||
"vite-ssg": "0.23.1",
|
||||
"vite-ssg": "0.23.2",
|
||||
"vite-ssg-sitemap": "0.5.1",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "^9.4.0",
|
||||
"vue-i18n": "^9.4.1",
|
||||
"vue-router": "^4.2.4",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
|
@ -128,7 +128,7 @@
|
|||
"@types/cross-spawn": "^6.0.3",
|
||||
"@types/ejs": "^3.1.2",
|
||||
"@types/html-to-text": "^9.0.1",
|
||||
"@types/katex": "^0.16.2",
|
||||
"@types/katex": "^0.16.3",
|
||||
"@types/markdown-it": "^13.0.1",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@types/yargs": "^17.0.24",
|
||||
|
|
581
pnpm-lock.yaml
581
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue