index.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <el-scrollbar wrap-class="scrollbar-wrapper">
  3. <div class="admin-title" @click="goBigScreen">
  4. <img src="../../../../../static/logo-dp.png" width="50" class="mt10" />
  5. </div>
  6. <el-menu :show-timeout="200" :default-active="$route.path" :collapse="isCollapse" mode="vertical">
  7. <sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
  8. </el-menu>
  9. </el-scrollbar>
  10. </template>
  11. <script>
  12. import { mapGetters } from 'vuex'
  13. import SidebarItem from './SidebarItem'
  14. export default {
  15. components: { SidebarItem },
  16. computed: {
  17. ...mapGetters(['sidebar']),
  18. routes() {
  19. return this.$router.options.routes
  20. },
  21. isCollapse() {
  22. return !this.sidebar.opened
  23. },
  24. },
  25. methods: {
  26. goBigScreen() {
  27. let routeUrl = this.$router.resolve({
  28. path: '/report/bigScreen',
  29. })
  30. window.open(routeUrl.href, '_blank')
  31. },
  32. },
  33. }
  34. </script>
  35. <style lang="scss" scoped>
  36. .admin-title {
  37. height: 60px;
  38. line-height: 60px;
  39. text-align: center;
  40. width: 100%;
  41. font-weight: 500;
  42. color: #333;
  43. font-size: 14px;
  44. background: #fff;
  45. }
  46. .admin-title:hover {
  47. cursor: pointer;
  48. }
  49. </style>