<template>
  <div id="listLeft">
    <el-row>
      <el-col :span="24" class="listLeft">
        <el-menu :default-active="path" class="el-menu-vertical-demo" :router="true">
          <template v-for="(item, index) in sideMenu">
            <el-menu-item v-if="item.type !== 'url' && item.type !== 'content'" :index="item.path" :key="index" :style="`color:${Color}`">
              {{ item.title }}
            </el-menu-item>
            <el-menu-item v-else-if="item.type === 'content'" :index="item.path" :key="index" :style="`color:${Color}`">{{ item.title }}</el-menu-item>
            <el-menu-item v-else :index="``" :key="index" @click="turnTo(item.url)" :style="`color:${Color}`">{{ item.title }}</el-menu-item>
          </template>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import _ from 'lodash';
export default {
  name: 'listLeft',
  props: {
    sideMenu: null,
    Color: null,
  },
  components: {},
  data: () => ({}),
  created() {},
  computed: {
    title() {
      return this.$route.query.title;
    },
    path() {
      let path = `${this.$route.path}`;
      if (this.title) path = `${path}?title=${this.title}`;
      return path;
    },
  },
  methods: {
    turnTo(url) {
      window.open(url);
    },
  },
};
</script>

<style lang="less" scoped>
/deep/.el-menu {
  border-right: none;
}
/deep/.el-menu-item {
  font-size: 24px;
  height: 60px;
  line-height: 60px;
  border-right: 2px solid transparent;
}
/deep/.el-menu-item.is-active {
  color: #415285;
  background: #b9c1d7;
  border-left: 5px solid #0457c7;
}
</style>
