<template>
  <div id="fenlei">
    <el-col class="swfl">
      <el-image style="width:22px;height:22px;margin:0 5px -5px 0;" :src="src"></el-image>
      <span>对外合作</span>
    </el-col>
    <el-col>
      <el-menu default-active="1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" text-color="#000" active-text-color="#000">
        <el-menu-item index="1" v-for="(item, index) in liebiaoList" :key="index"
          ><span slot="title" @click="clickUrl(item.title, index)" :style="`color:${menuIndex == index ? color : ''}`">{{ item.title }}</span></el-menu-item
        >
      </el-menu>
    </el-col>
  </div>
</template>

<script>
export default {
  name: 'fenlei',
  props: {},
  components: {},
  data: () => ({
    menuIndex: '',
    color: '',
    src: require('@/assets/achieveCenter.png'),
    liebiaoList: [{ title: '超算联盟' }, { title: '国家网格' }, { title: '教学中心' }, { title: '创业基地' }, { title: '软件中心' }],
  }),
  created() {},
  computed: {},
  methods: {
    clickUrl(title, index) {
      if (title == '超算联盟') {
        this.menuIndex = index;
        this.color = '#054982';
      } else if (title == '国家网格') {
        this.menuIndex = index;
        this.color = '#054982';
      } else if (title == '教学中心') {
        this.menuIndex = index;
        this.color = '#054982';
      } else if (title == '创业基地') {
        this.menuIndex = index;
        this.color = '#054982';
      } else if (title == '软件中心') {
        this.menuIndex = index;
        this.color = '#054982';
      }

      this.$emit('leftdaohang', title);
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>

<style lang="less" scoped>
.swfl {
  height: 70px;
  width: 250px;
  line-height: 70px;
  background-color: #22529a;
  text-align: center;
}
.swfl span {
  font-size: 22px;
  color: #ffffff;
}
/deep/.el-menu-item {
  height: 60px;
  text-align: center;
  line-height: 60px;
  border-bottom: 1px dashed;
  font-size: 22px;
  font-weight: bold;
}
/deep/.el-menu-item:last-child {
  border-bottom: none;
}
</style>
