<template>
  <div>
    <el-menu
      :default-active="defaultUrl"
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      :router="true"
    >
      <el-menu-item
        v-for="(route, key) in routers"
        :key="key"
        :index="route.router"
      >
        <i class="el-icon-menu"></i>
        <span slot="title">{{ route.name }}</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>
<script>
export default {
  data() {
    return {
      routers: [
        {
          name: "交付范围",
          router: "workscope",
        },
        {
          name: "生成二维码",
          router: "qrcode",
        },
        {
          name: "空间任务",
          router: "spacetask",
        },
      ],
      defaultUrl:''
    };
  },
  created(){
    this.defaultUrl = this.$route.name;
  }
};
</script>