<template>
    <div>
      <commonProduct mainTitle="中兴智能交通" subTitle="构建绿色交通 享受安全便利出行"></commonProduct>
      <div class="tab-wrapper">
        <ul class="tab-main widthCommon">
          <li
            v-for="(item, index) in tabData"
            :key="item"
            @click="changeTab(index)"
            :class="{tabActive:currentIndex==index}"
          >{{item}}</li>
        </ul>
      </div>

      <div class="bread widthCommon">
        您所在位置: <span class="pointer" @click="$router.push({name:'home'})">首页</span> -> 产品中心 -> 智慧停车
      </div>

      <keep-alive>
        <component :is="tabView"></component>
      </keep-alive>

    </div>
</template>

<script>
import commonProduct from '@/components/commonBanner'
import selectTab0 from './components/selectTab0'
import selectTab1 from './components/selectTab1'
import selectTab2 from './components/selectTab2'
export default {
  name: 'index',
  components:{
    commonProduct, selectTab0, selectTab1, selectTab2
  },
  data(){
    return{
      tabData:[
        '智慧停车','公安交通','公共交通'
      ],
      currentIndex:0,
      tabView:'selectTab0'
    }
  },
  methods:{
    changeTab:function (index) {
      console.log(index)
      this.currentIndex = index
      this.tabView = 'selectTab'+index
    }
  }

}
</script>

<style scoped lang="scss">

  .tab-wrapper{
    height:50px;
    background:rgba(237,237,237,1);
    /*line-height: 50px;*/
    padding-top: 5px;
  }
  .tab-main{
    padding-left: 100px;
    height: 45px;
    line-height: 45px;
  }
  .tab-main li{
    float: left;
    margin-right: 50px;
    width: 125px;

    border-radius: 5px;
    color: #333;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
  }
  .tabActive{
    background: #FFF;
  }
  .bread{
    padding: 35px 0;
    color: #333;
    font-size: 14px;
  }
</style>
