Layout.vue 824 字节
Newer Older
E
Evan You 已提交
1
<template>
E
wip  
Evan You 已提交
2 3
  <div class="theme-container">
    <ul class="nav">
E
Evan You 已提交
4
      <li v-for="page in $site.pages">
E
Evan You 已提交
5
        <router-link :to="page.path">{{ page.title || page.path }}</router-link>
E
Evan You 已提交
6 7
      </li>
    </ul>
E
Evan You 已提交
8
    <Index v-if="$page.path === '/index'" />
E
Evan You 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
    <Page v-else />
  </div>
</template>

<script>
import nprogress from 'nprogress'
import Index from './Index.vue'
import Page from './Page.vue'

export default {
  components: { Index, Page },
  mounted () {
    nprogress.configure({ showSpinner: false })

    this.$router.beforeEach((to, from, next) => {
E
Evan You 已提交
24 25 26
      if (to.path !== from.path) {
        nprogress.start()
      }
E
Evan You 已提交
27 28 29 30 31 32 33 34 35 36
      next()
    })

    this.$router.afterEach(() => {
      nprogress.done()
    })
  }
}
</script>

E
Evan You 已提交
37
<style src="prismjs/themes/prism-tomorrow.css"></style>
E
Evan You 已提交
38
<style src="./styles.css"></style>