<template>
  <el-menu-item
    v-if="menu.name != '报警中心'"
    :index="menu.path || uniqueId"
    @click="handleMenuClick"
  >
    <!-- <i v-if="menu.icon" :class="`fa fa-${menu.icon}`"></i> -->
    <span :class="menu.icon" class="menu_icon"></span>
    <!-- <d2-icon-svg v-else-if="menu.iconSvg" :name="menu.iconSvg"/> -->
    <!-- <i v-else class="fa fa-file-o"></i> -->
    <span class="zMenu_item" slot="title">{{
      menu.title || '未命名菜单'
    }}</span>
  </el-menu-item>
</template>

<script>
import { uniqueId } from 'lodash'
export default {
  inject: ['reload'],
  name: 'd2-layout-header-aside-menu-item',
  props: {
    menu: {
      type: Object,
      required: false,
      default: () => {}
    }
  },
  data() {
    return {
      uniqueId: uniqueId('d2-menu-empty-')
    }
  },
  methods: {
    handleMenuClick() {
      //点击菜单时重新刷新页面
      //this.reload()
    }
  }
}
</script>
<style>
.menu_icon {
  width: 22px;
  height: 22px;
  transform: translateY(10px);
}
.sys {
  background: url(../../../imgs/iconImg/sys.png);
  background-size: 100% 100%;
}
.scene {
  background: url(../../../imgs/iconImg/em.png);
  background-size: 100% 100%;
}
.eq {
  background: url(../../../imgs/iconImg/eq.png);
  background-size: 100% 100%;
}
.plan {
  background: url(../../../imgs/iconImg/plan.png);
  background-size: 100% 100%;
}
.stats {
  background: url(../../../imgs/iconImg/linkage.png);
  background-size: 100% 100%;
}
.monitor {
  background: url(../../../imgs/iconImg/monitor.png);
  background-size: 100% 100%;
}
.fire {
  background: url(../../../imgs/iconImg/access.png);
  background-size: 100% 100%;
}
.police {
  background: url(../../../imgs/iconImg/police.png);
  background-size: 100% 100%;
}
.inspect {
  background: url(../../../imgs/iconImg/inspect.png);
  background-size: 100% 100%;
}
.patrol {
  background: url(../../../imgs/iconImg/patrol.png);
  background-size: 100% 100%;
}
.ol {
  background: url(../../../imgs/iconImg/ol.png);
  background-size: 100% 100%;
}

/* .zMenu_item{
 color:rgba(255,255,255,0.75);
} */
</style>
