<template>
  <ul class="v_chart_tab block">
    <li
      v-for="(name,i) in tabs"
      :key="i"
      :class="{active:i==$store.statistic_tab_active}"
      @click="$store.statistic_tab_active=i"
      v-text="name"
    />
  </ul>
</template>

<script>
export default {
  created () {
    this.$store.statistic_tab_active = 0
    this.tabs = ['总体分析', '详细分析']
  }
}
</script>

<style lang="scss">
.v_chart_tab {
  margin-bottom: 20px;
  padding: 0;
  width: 100%;
  display: flex;
  border-bottom: 1px solid #DCDFE6;
  user-select: none;
  position: sticky;
  top: -18px;
  z-index: 30;

  &::before {
    content: '';
    position: absolute;
    left: -18px;
    right: -18px;
    top: 0;
    bottom: 0;
    background-color: #fff;
  }

  > li {
    display: block;
    line-height: 3;
    font-size: 15px;
    color: #666;
    z-index: 1;
    cursor: pointer;

    &.active,
    &:hover {
      color: $--color-primary;
    }

    & + li {
      margin-left: 20px;
    }
  }
}
</style>
