mirror of https://github.com/YunYouJun/valaxy
docs: add how to custom theme component
This commit is contained in:
parent
588f061a65
commit
cd0d3f398a
|
@ -0,0 +1,9 @@
|
|||
<script lang="ts" setup>
|
||||
import YunFooter from 'valaxy-theme-yun/components/YunFooter.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<YunFooter>
|
||||
自定义页脚内容
|
||||
</YunFooter>
|
||||
</template>
|
|
@ -28,6 +28,38 @@ Valaxy 以约定大于配置的方式提供了强大的扩展功能,如果你
|
|||
如果存在与主题、Valaxy 的同名组件,覆盖顺序为 `用户目录` -> `主题目录` -> `Valaxy 客户端目录`。
|
||||
这也意味着你可以只覆盖主题的某个组件,来达到自定义局部主题的效果!
|
||||
|
||||
### 自定义覆盖主题组件
|
||||
|
||||
基于此,你可以非常容易地自定义主题的任何地方!
|
||||
|
||||
譬如自定义页脚:
|
||||
|
||||
> 可参见 [demo/yun/components/YunFooter.vue | GitHub](https://github.com/YunYouJun/valaxy/blob/main/demo/yun/components/YunFooter.vue)
|
||||
|
||||
在博客文件夹中 `components` 目录下,新建 `YunFooter.vue` 覆盖你的主题页脚文件。
|
||||
|
||||
你可以直接替换掉页脚内容:
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div>页脚内容</div>
|
||||
</template>
|
||||
```
|
||||
|
||||
也可以继承扩展此前的页脚:
|
||||
|
||||
```vue
|
||||
<script lang="ts" setup>
|
||||
import YunFooter from 'valaxy-theme-yun/components/YunFooter.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<YunFooter>
|
||||
自定义页脚内容
|
||||
</YunFooter>
|
||||
</template>
|
||||
```
|
||||
|
||||
## 自动布局注册
|
||||
|
||||
基于 [vite-plugin-vue-layouts](https://github.com/JohnCampionJr/vite-plugin-vue-layouts),Valaxy 提供了布局功能。
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.28.0",
|
||||
"husky": "^8.0.2",
|
||||
"lint-staged": "^13.0.3",
|
||||
"lint-staged": "^13.0.4",
|
||||
"prompts": "^2.4.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"tsup": "^6.5.0",
|
||||
|
|
|
@ -16,7 +16,7 @@ const props = defineProps<{
|
|||
|
||||
const route = useRoute()
|
||||
const { locale } = useI18n()
|
||||
const path = computed(() => route.path)
|
||||
const path = computed(() => props.options.path || route.path.replace(/\/$/, ''))
|
||||
const emoji = computed(() => getEmojis(props.options.cdn))
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "valaxy-addon-waline",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.5",
|
||||
"description": "Waline Composition API for Valaxy",
|
||||
"keywords": [
|
||||
"valaxy",
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
export interface WalineOptions {
|
||||
serverURL: string
|
||||
import type { WalineInitOptions } from '@waline/client'
|
||||
export interface WalineCustomOptions {
|
||||
/**
|
||||
* emoji cdn
|
||||
*/
|
||||
cdn?: string
|
||||
}
|
||||
|
||||
export type WalineOptions = { cdn?: string } & WalineInitOptions
|
||||
|
|
|
@ -192,7 +192,9 @@ export async function createMarkdownToVueRenderFn(
|
|||
if (
|
||||
!pages.includes(resolved)
|
||||
&& !fs.existsSync(path.resolve(dir, publicDir, `${resolved}.html`))
|
||||
&& !(resolved.endsWith('/') && pages.includes(resolved.slice(0, -1)))
|
||||
&& !(resolved.endsWith('/') && (
|
||||
pages.includes(resolved.slice(0, -1)) || pages.includes(`${resolved}index`)
|
||||
))
|
||||
)
|
||||
recordDeadLink(url)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ importers:
|
|||
cross-env: ^7.0.3
|
||||
eslint: ^8.28.0
|
||||
husky: ^8.0.2
|
||||
lint-staged: ^13.0.3
|
||||
lint-staged: ^13.0.4
|
||||
prompts: ^2.4.2
|
||||
rimraf: ^3.0.2
|
||||
tsup: ^6.5.0
|
||||
|
@ -34,7 +34,7 @@ importers:
|
|||
cross-env: 7.0.3
|
||||
eslint: 8.28.0
|
||||
husky: 8.0.2
|
||||
lint-staged: 13.0.3
|
||||
lint-staged: 13.0.4
|
||||
prompts: 2.4.2
|
||||
rimraf: 3.0.2
|
||||
tsup: 6.5.0_typescript@4.9.3
|
||||
|
@ -1910,8 +1910,8 @@ packages:
|
|||
dependencies:
|
||||
color-convert: 2.0.1
|
||||
|
||||
/ansi-styles/6.1.0:
|
||||
resolution: {integrity: sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==}
|
||||
/ansi-styles/6.2.1:
|
||||
resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==}
|
||||
engines: {node: '>=12'}
|
||||
dev: true
|
||||
|
||||
|
@ -2306,8 +2306,8 @@ packages:
|
|||
engines: {node: '>= 12'}
|
||||
dev: false
|
||||
|
||||
/commander/9.4.0:
|
||||
resolution: {integrity: sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==}
|
||||
/commander/9.4.1:
|
||||
resolution: {integrity: sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==}
|
||||
engines: {node: ^12.20.0 || >=14}
|
||||
dev: true
|
||||
|
||||
|
@ -4515,11 +4515,6 @@ packages:
|
|||
type-check: 0.4.0
|
||||
dev: true
|
||||
|
||||
/lilconfig/2.0.5:
|
||||
resolution: {integrity: sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==}
|
||||
engines: {node: '>=10'}
|
||||
dev: true
|
||||
|
||||
/lilconfig/2.0.6:
|
||||
resolution: {integrity: sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==}
|
||||
engines: {node: '>=10'}
|
||||
|
@ -4534,32 +4529,32 @@ packages:
|
|||
dependencies:
|
||||
uc.micro: 1.0.6
|
||||
|
||||
/lint-staged/13.0.3:
|
||||
resolution: {integrity: sha512-9hmrwSCFroTSYLjflGI8Uk+GWAwMB4OlpU4bMJEAT5d/llQwtYKoim4bLOyLCuWFAhWEupE0vkIFqtw/WIsPug==}
|
||||
/lint-staged/13.0.4:
|
||||
resolution: {integrity: sha512-HxlHCXoYRsq9QCby5wFozmZW00hMs/9e3l+/dz6Qr8Kle4UH0kJTdABAbqhzG+3pcG6QjL9kz7NgGBfph+a5dw==}
|
||||
engines: {node: ^14.13.1 || >=16.0.0}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
cli-truncate: 3.1.0
|
||||
colorette: 2.0.19
|
||||
commander: 9.4.0
|
||||
commander: 9.4.1
|
||||
debug: 4.3.4
|
||||
execa: 6.1.0
|
||||
lilconfig: 2.0.5
|
||||
listr2: 4.0.5
|
||||
lilconfig: 2.0.6
|
||||
listr2: 5.0.5
|
||||
micromatch: 4.0.5
|
||||
normalize-path: 3.0.0
|
||||
object-inspect: 1.12.2
|
||||
pidtree: 0.6.0
|
||||
string-argv: 0.3.1
|
||||
yaml: 2.1.1
|
||||
yaml: 2.1.3
|
||||
transitivePeerDependencies:
|
||||
- enquirer
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/listr2/4.0.5:
|
||||
resolution: {integrity: sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA==}
|
||||
engines: {node: '>=12'}
|
||||
/listr2/5.0.5:
|
||||
resolution: {integrity: sha512-DpBel6fczu7oQKTXMekeprc0o3XDgGMkD7JNYyX+X0xbwK+xgrx9dcyKoXKqpLSUvAWfmoePS7kavniOcq3r4w==}
|
||||
engines: {node: ^14.13.1 || >=16.0.0}
|
||||
peerDependencies:
|
||||
enquirer: '>= 2.3.0 < 3'
|
||||
peerDependenciesMeta:
|
||||
|
@ -4571,7 +4566,7 @@ packages:
|
|||
log-update: 4.0.0
|
||||
p-map: 4.0.0
|
||||
rfdc: 1.3.0
|
||||
rxjs: 7.5.6
|
||||
rxjs: 7.5.7
|
||||
through: 2.3.8
|
||||
wrap-ansi: 7.0.0
|
||||
dev: true
|
||||
|
@ -5613,10 +5608,10 @@ packages:
|
|||
dependencies:
|
||||
queue-microtask: 1.2.3
|
||||
|
||||
/rxjs/7.5.6:
|
||||
resolution: {integrity: sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==}
|
||||
/rxjs/7.5.7:
|
||||
resolution: {integrity: sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==}
|
||||
dependencies:
|
||||
tslib: 2.4.0
|
||||
tslib: 2.4.1
|
||||
dev: true
|
||||
|
||||
/safe-buffer/5.1.2:
|
||||
|
@ -5814,7 +5809,7 @@ packages:
|
|||
resolution: {integrity: sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
ansi-styles: 6.1.0
|
||||
ansi-styles: 6.2.1
|
||||
is-fullwidth-code-point: 4.0.0
|
||||
dev: true
|
||||
|
||||
|
@ -6210,6 +6205,11 @@ packages:
|
|||
|
||||
/tslib/2.4.0:
|
||||
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
|
||||
dev: false
|
||||
|
||||
/tslib/2.4.1:
|
||||
resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==}
|
||||
dev: true
|
||||
|
||||
/tsup/6.5.0_typescript@4.9.3:
|
||||
resolution: {integrity: sha512-36u82r7rYqRHFkD15R20Cd4ercPkbYmuvRkz3Q1LCm5BsiFNUgpo36zbjVhCOgvjyxNBWNKHsaD5Rl8SykfzNA==}
|
||||
|
@ -6993,6 +6993,7 @@ packages:
|
|||
/yaml/2.1.1:
|
||||
resolution: {integrity: sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw==}
|
||||
engines: {node: '>= 14'}
|
||||
dev: false
|
||||
|
||||
/yaml/2.1.3:
|
||||
resolution: {integrity: sha512-AacA8nRULjKMX2DvWvOAdBZMOfQlypSFkjcOcu9FalllIDJ1kvlREzcdIZmidQUqqeMv7jorHjq2HlLv/+c2lg==}
|
||||
|
|
Loading…
Reference in New Issue