1
0
Fork 0
mirror of https://github.com/Luzifer/wiki.git synced 2024-11-09 15:20:07 +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
</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>
<router-view />
@ -18,7 +37,40 @@
</template>
<script>
import axios from 'axios'
import VueMarkdown from 'vue-markdown'
export default {
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>