1
0
Fork 0
mirror of https://github.com/em-squared/5e-drs.git synced 2025-10-30 13:14:20 +00:00

table of contents in pages

This commit is contained in:
Maxime Moraine 2020-04-02 14:20:33 +02:00
parent f415fa8613
commit a6e1803b23
12 changed files with 165 additions and 10 deletions

View file

@ -0,0 +1,63 @@
<template>
<div class="page-toc mt-4">
<p class="subtitle-2 pl-6 pr-6">Table des matières</p>
<ul>
<li :class="[ itemPadding(h), 'mb-1' ]" v-for="h in headers">
<a :href="anchor(h)">{{ h.title }}</a>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'PageToc',
data () {
return {
}
},
computed: {
headers () {
return this.$page.headers
}
},
methods: {
anchor (h) {
return '#' + h.slug
},
itemPadding (h) {
return 'pl-' + (h.level - 2) * 4
}
},
mounted () {
}
}
</script>
<style lang="scss">
@import '../styles/colors';
.page-toc {
ul {
list-style: none;
padding-right: 24px;
li {
a {
color: $color-gray;
text-decoration: none;
&:hover {
color: $color-dragon;
}
}
}
}
}
</style>