Layout.vue 1.2 KB
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.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 38
<style src="prismjs/themes/prism-tomorrow.css"></style>
<style src="./nprogress.css"></style>
E
Evan You 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<style>
.theme-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}

pre[class*="language-"] {
  line-height: 1.4;
  border-radius: 5px;
}

pre[class*="language-"] code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
</style>