Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义Toc.vue的标题 #85

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
自定义Toc.vue的标题
允许自定义Toc.vue的标题
0xlau authored Dec 14, 2022
commit eaf245b36f40a6f4b97b2c1e325e7949d2cb229c
10 changes: 9 additions & 1 deletion packages/vuepress-theme-vt/components/Toc.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<Sticker class="vuepress-toc" v-bind="$attrs" v-if="visible">
<div class="on-this-page">ON THIS PAGE</div>
<div class="on-this-page">{{ tocTitle }}</div>
<div
class="vuepress-toc-item"
ref="chairTocItem"
@@ -48,6 +48,14 @@ export default {
!!(this.$page && this.$page.headers && this.$page.headers.length)
);
},
tocTitle() {
return (
this.$page.frontmatter.tocTitle ||
this.$localeConfig.tocTitle ||
this.$site.themeConfig.tocTitle ||
"ON THIS PAGE"
);
},
},
watch: {