<template>
  <div class="topTab">
    <div class="arr leftArr" @click='toLeft'></div>
    <div class="arr rightArr" @click='toRight'></div>
    <el-scrollbar ref="groupTeamScroll" :vertical="false"  class="scrollTab">
      <ul class="tabBox">
        <li :class="{'active':roomNameDict===item.value}" v-for="(item, index) in getDictDatas('workshop')" :key='index' @click='toggleName(item.value)'>{{item.label}}</li>
      </ul>
    </el-scrollbar>
  </div>
</template>
<script>
export default {
  name: 'TopTab',
  data() {
    return {
      
    }
  },
  props:['roomNameDict'],
  computed: {
    scrollWrapper() {
      return this.$refs.groupTeamScroll.$refs.wrap
    }
  },
  methods:{
    toLeft() {
      const container = this.scrollWrapper
      container.scrollLeft-=100
    },
    toRight() {
      const container = this.scrollWrapper
      container.scrollLeft+=100
    },
    toggleName(val) {
      this.$emit('emitFun',val)
    }
  }
}
</script>
<style lang="scss" scoped>
.topTab {
  height: 56px;
  padding: 0px 48px 0px 56px;
  position: relative;
  .arr {
    position: absolute;
    width: 48px;
    height: 48px;
    line-height: 48px;
    background-color: #fff;
    border-radius: 8px;
    cursor: pointer;
  }
  .leftArr{
    left: 0;
    padding-left: 10px;
  }
  .leftArr::before{
    display: inline-block;
    content: '';
    width: 0;
    height: 0;
    border-width: 8px;
    border-style: solid;
    border-color: transparent #0B58FF transparent transparent;
  }
  .rightArr{
    right: 0;
    top:0;
    padding-left: 22px;
  }
  .rightArr::before{
    display: inline-block;
    content: '';
    width: 0;
    height: 0;
    border-width: 8px;
    border-style: solid;
    border-color: transparent transparent transparent #0B58FF;
  }
  .scrollTab{
    white-space: nowrap;
    overflow: hidden;
    font-size: 16px;
    width: 100%;
    height: 100%;
    ul,li{
      list-style: none;
      margin: 0;
      padding: 0;
    }
    .tabBox >.active {
      border-bottom: 4px solid #0B58FF;
    }
    .tabBox>li {
      display: inline-block;
      height: 48px;
      line-height: 48px;
      background: #FFFFFF;
      border-radius: 8px;
      padding: 0px 10px;
      margin-right: 8px;
      cursor: pointer;
    }
  }
}
</style>