1
0
Fork 0
mirror of https://github.com/Luzifer/wiki.git synced 2024-12-20 10:31:18 +00:00

Add top navigation

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-08-15 22:38:19 +02:00
parent 9a2aaeef59
commit e1d545aca7
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -11,6 +11,25 @@
> >
Wiki Wiki
</b-navbar-brand> </b-navbar-brand>
<b-navbar-nav>
<b-nav-item
v-for="page in navContent"
:key="page"
:to="{ name: 'view', params: { page } }"
>
{{ page }}
</b-nav-item>
</b-navbar-nav>
<template ref="nav">
<vue-markdown
class="nav"
:source="navContent"
:prerender="prerender"
@rendered="rendered"
/>
</template>
</b-navbar> </b-navbar>
<router-view /> <router-view />
@ -18,7 +37,40 @@
</template> </template>
<script> <script>
import axios from 'axios'
import VueMarkdown from 'vue-markdown'
export default { export default {
name: 'App', name: 'App',
components: {
VueMarkdown,
},
data() {
return {
navContent: '',
}
},
mounted() {
this.loadNav()
},
methods: {
loadNav() {
axios.get(`/_content/_navigation`)
.then(resp => {
this.navContent = resp.data.content.split('\n')
.filter(el => !el.match(/^!/))
})
.catch(err => {
if (err.response && err.response.status === 404) {
return
}
console.error(err)
})
},
},
} }
</script> </script>