listLeft.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div id="listLeft">
  3. <el-row>
  4. <el-col :span="24" class="listLeft">
  5. <el-menu :default-active="path" class="el-menu-vertical-demo" :router="true">
  6. <template v-for="(item, index) in sideMenu">
  7. <el-menu-item v-if="item.type !== 'url' && item.type !== 'content'" :index="item.path" :key="index" :style="`color:${Color}`">
  8. {{ item.title }}
  9. </el-menu-item>
  10. <el-menu-item v-else-if="item.type === 'content'" :index="item.path" :key="index" :style="`color:${Color}`">{{ item.title }}</el-menu-item>
  11. <el-menu-item v-else :index="``" :key="index" @click="turnTo(item.url)" :style="`color:${Color}`">{{ item.title }}</el-menu-item>
  12. </template>
  13. </el-menu>
  14. </el-col>
  15. </el-row>
  16. </div>
  17. </template>
  18. <script>
  19. import _ from 'lodash';
  20. export default {
  21. name: 'listLeft',
  22. props: {
  23. sideMenu: null,
  24. Color: null,
  25. },
  26. components: {},
  27. data: () => ({}),
  28. created() {},
  29. computed: {
  30. title() {
  31. return this.$route.query.title;
  32. },
  33. path() {
  34. let path = `${this.$route.path}`;
  35. if (this.title) path = `${path}?title=${this.title}`;
  36. return path;
  37. },
  38. },
  39. methods: {
  40. turnTo(url) {
  41. window.open(url);
  42. },
  43. },
  44. };
  45. </script>
  46. <style lang="less" scoped>
  47. /deep/.el-menu {
  48. border-right: none;
  49. }
  50. /deep/.el-menu-item {
  51. font-size: 24px;
  52. height: 60px;
  53. line-height: 60px;
  54. border-right: 2px solid transparent;
  55. }
  56. /deep/.el-menu-item.is-active {
  57. color: #415285;
  58. background: #b9c1d7;
  59. border-left: 5px solid #0457c7;
  60. }
  61. </style>