feat: add toc

This commit is contained in:
Justineo 2021-10-28 17:03:43 +08:00
parent 5240cfd31b
commit f69013b752
No known key found for this signature in database
GPG Key ID: B73F0979CF18A0EA
4 changed files with 12 additions and 7 deletions

View File

@ -5,6 +5,7 @@ margin-y($top, $bottom = $top)
margin-bottom $bottom
.post
position relative
padding 30px 60px
font-size 14px
line-height 1.8

View File

@ -1,8 +1,9 @@
<template>
<nav class="one-toc">
<veui-anchor
:items="flattenItems"
ui="s"
sticky
:items="flattenItems"
/>
</nav>
</template>
@ -25,8 +26,3 @@ export default {
}
}
</script>
<style lang="stylus" scoped>
.one-toc
float right
</style>

View File

@ -110,4 +110,11 @@ main
min-width 0
</style>
<style lang="stylus">
.one-toc
position absolute
left 100%
top 120px
</style>
<style lang="stylus" src="@/assets/styles/post.styl"></style>

View File

@ -1,5 +1,6 @@
<template>
<article ref="article" class="content ${style}">
<article ref="article" class="content ${style}"><!-- if: ${toc} -->
<one-toc :items="toc"/><!-- /if -->
${content | raw}
<section class="meta">
<one-edit-link path="${path}"/>