<!--
 * @Description: 详情tab
 * @Author: your name
 * @Date: 2019-09-25 19:47:59
 * @LastEditTime: 2019-11-04 14:34:16
 * @LastEditors: Please set LastEditors
 -->
<template>
  <div class="tab-style">
    <a :class="{'tab-content-bg':tabNum == 0}" class="tab-content" href="#baseInfo" @click="tabNum = 0;sendTabNum()"><img :src="tabNum == 0?baseInfo:unBaseInfo"><span
      :class="{'colored':tabNum == 0}">基本信息</span></a>
    <a :class="{'tab-content-bg':tabNum == 1}" class="tab-content" href="#prodetail" @click="tabNum = 1;sendTabNum()"><img :src="tabNum == 1?detail:unDetail"><span
      :class="{'colored':tabNum == 1}">商品详情</span></a>
    <a :class="{'tab-content-bg':tabNum == 2}" class="tab-content" href="#procfg" @click="tabNum = 2;sendTabNum()"><img :src="tabNum == 2?config:unConfig"><span
      :class="{'colored':tabNum == 2}">产品配置</span></a>
  </div>
</template>
<script>
import baseInfo from '@/assets/productQuery/baseInfo.png'
import unBaseInfo from '@/assets/productQuery/unBaseInfo.png'
import detail from '@/assets/productQuery/detail.png'
import unDetail from '@/assets/productQuery/unDetail.png'
import config from '@/assets/productQuery/config.png'
import unConfig from '@/assets/productQuery/unConfig.png'
export default {
  props: {
    tabNums: {
      type: Number,
      default: 0,
    },
  },
  data () {
    return {
      tabNum: this.tabNums,
      baseInfo: baseInfo,
      unBaseInfo: unBaseInfo,
      detail: detail,
      unDetail: unDetail,
      config: config,
      unConfig: unConfig,
    }
  },
  watch: {
    tabNums () {
      this.tabNum = this.tabNums
    },
  },
  methods: {
    sendTabNum () {
      this.$emit('getTabNum', this.tabNum)
    },
  },
}
</script>
<style lang="less" scoped>
.tab-style{
    position: relative;
    z-index: 50;
    background-color: #fff;
    display:flex;
    justify-content: center;
    padding-top:12px;
    padding-bottom: 8px;
    align-items: center;
    box-shadow:0 2px 3px 0  rgba(220,220,221,0.50);
    .tab-content {
      display: block;
      width: 33%;
      height: 32px;
      background: rgba(220, 220, 221, 0.26);
      border-radius: 16px;
      display: flex;
      justify-content: center;
      align-items: center;

      span {
        margin-left: 2%;
        font-size: 14px;
        color: #383F45;
        font-weight: 600;
        font-family: PingFangSC-Semibold;
      }

      .colored {
        color: #00469C
      }
    }
    .tab-content-bg{
      background: rgba(0,70,156,0.10);
    }

    .tab-content:nth-of-type(1) {
      margin-left: 12px
    }

    img {
      height: 16px;
      // margin-right:5.7px;
    }

    .tab-content:nth-of-type(2) {
      margin-left: 8px;
    }
    .tab-content:nth-of-type(3) {
      margin-left: 8px;
      margin-right: 4px;
    }
}
</style>
