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 all commits
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
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="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"
Expand Down Expand Up @@ -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: {
Expand Down