App.vue 1.97 KB
<template>
  <div id="app">
    <div class="wrapper-header">
      <img class="logo" src="./assets/logo.png" alt="" />
      <a-menu v-model="current" mode="horizontal">
        <a-menu-item key="folder" @click="handleTab('Folder')">
          <a-icon type="home" />
          项目主页
        </a-menu-item>
        <a-menu-item key="DocumentClassify" @click="handleTab('DocumentClassify')">
          <a-icon type="file-text" />
          项目文档描述
        </a-menu-item>
        <a-menu-item key="record" @click="handleTab('Record')">
          <a-icon type="message" />
          问题记录
        </a-menu-item>
      </a-menu>
    </div>
    <div class="wrapper-content">
      <router-view />
    </div>
  </div>
</template>

<script>
let currentName = ''
export default {
  name: 'App',
  data() {
    return {
      current: ['folder']
    }
  },
  mounted() {
    currentName = window.location.pathname.substr(1)
    console.log(currentName)
    if (!currentName) this.current = ['folder']
    else this.current = [currentName]
  },
  methods: {
    handleTab(name) {
      this.to(name)
    }
  }
}
</script>

<style lang="scss">
#app {
  display: flex;
  flex-flow: column;
  height: 100vh;
  overflow: hidden;
}
.wrapper-header {
  display: flex;
  background-color: #2b303b;
  height: 50px;
}
.wrapper-header .logo {
  display: inline-flex;
  width: 50px;
  height: 50px;
}
.wrapper-header .ant-menu {
  display: inline-flex;
  background-color: #2b303b;
  color: #fff;
}
.wrapper-header .ant-menu-horizontal > .ant-menu-item:hover,
.wrapper-header .ant-menu-horizontal > .ant-menu-item-active,
.wrapper-header .ant-menu-horizontal > .ant-menu-item-selected {
  border-bottom: none;
}
.wrapper-header .ant-menu-horizontal {
  border-bottom: none;
}
.wrapper-header .ant-menu-horizontal > .ant-menu-item > a {
  color: #fff;
}
.wrapper-content {
  overflow-y: auto;
  margin: 30px auto;
  padding: 0 10px;
  width: 100%;
  & > div {
    max-width: 1300px;
    margin: 0 auto;
  }
}
</style>