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 margin-bottom $bottom
.post .post
position relative
padding 30px 60px padding 30px 60px
font-size 14px font-size 14px
line-height 1.8 line-height 1.8

View File

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

View File

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

View File

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