<template>
  <Topbar nav="docs" />
  <main class="body">
    <Menu />
    <wc-scroll class="content" ref="detail">
      <wc-markd class="detail" :code="docset"></wc-markd>
    </wc-scroll>
  </main>
</template>

<script>
import Topbar from '../index/components/topbar.vue'
import Menu from './components/aside.vue'

import fetch from 'fetch'

export default {
  components: {
    Topbar,
    Menu
  },
  data() {
    return {
      docset: ''
    }
  },

  mounted() {
    let key = location.search.slice(1)

    fetch(`/docset/ui/${key}.md`)
      .then(r => r.text())
      .then(r => {
        this.docset = r
      })
      .catch(r => {
        this.docset = 'Oops!!! 你要浏览的文档, 被外星人吃了~~'
      })
  }
}
</script>

<style lang="scss">
body {
  line-height: 1.5;
  font-size: 14px;
  color: var(--color-dark-1);
}
a {
  color: inherit;
  text-decoration: none;
}
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
</style>

<style scoped>
.body {
  flex: 1;
  display: flex;
}

.content {
  flex: 1;
  height: 100%;
}
.wrapper {
  width: 100%;
  height: 100%;
}
</style>
