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:
parent
9a2aaeef59
commit
e1d545aca7
1 changed files with 52 additions and 0 deletions
52
src/app.vue
52
src/app.vue
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue