<template>
  <div class="influence-wrap">
    <div class="sider">
       <div
        class="sider-btn"
        :class="{ siderBtnActive: item.isActive }"
        @click="handleClickLeftSiderBtn(item,index)"
        v-for="(item, index) in siderBtnList"
        :key="index"
      >
        <div class="btn-text">{{ item.name }}</div>
        <div class="btn-icon">
          <el-icon v-if="item.isActive" color="#fff"
            ><CaretRight
          /></el-icon>
        </div>
      </div>
    </div>
    <div class="main">
      <router-view />
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref } from "vue";
import router from "@/router";

const siderBtnList = ref([
  {
    name: "对华产业影响",
    isActive: true,
    path: "/billLayout/influence/industry",
  },
  // {
  //   name: "对华科研影响",
  //   isActive: false,
  //   path: "/billLayout/influence/scientificResearch",
  // },
]);

const handleClickLeftSiderBtn = (item,index) => {
  siderBtnList.value.forEach(item => {
    item.isActive = false
  })
  siderBtnList.value[index].isActive = true
  router.push({
    path: item.path,
    query: {
      billId: route.query.billId
    }
  });
};

</script>

<style lang="scss" scoped>
.influence-wrap {
   display: flex;
  height: 879px;
  position: relative;
  // background: (243, 243, 244, 1);
  .sider {
    width: 160px;
    position: absolute;
    top: 0;
    left: -160px;
    .sider-btn {
      margin-top: 20px;
      margin-left: 10px;
      width: 136px;
      height: 32px;
      display: flex;
      border-radius: 16px;
      cursor: pointer;
      .btn-text {
        width: 110px;
        margin-left: 18px;
        height: 32px;
        line-height: 32px;
        text-align: left;
        box-sizing: border-box;
        font-size: 16px;
        font-family: Microsoft YaHei;
        color: rgba(95, 101, 108, 1);
      }
      .btn-icon {
        width: 22px;
        padding-top: 9px;
      }
    }
    .siderBtnActive {
      background: var(--color-main-active);
      .btn-text {
        color: #fff !important;
      }
    }
  }
}
</style>
