Blame view

src/views/news/index.vue 2.02 KB
b608a198   liuqimichale   新闻中心
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  <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,item)"
              :class="{tabActive:currentIndex==index}"
            >{{item}}</li>
          </ul>
        </div>
        <div class="bread ">
          <div class=" widthCommon">
            您所在位置: <span class="pointer" @click="$router.push({name:'home'})">首页</span> -> 新闻中心 -> {{name}}
          </div>
        </div>
        <div class="widthCommon">
          <keep-alive>
            <component :is="tabView"></component>
          </keep-alive>
        </div>
  
      </div>
  </template>
  
  <script>
  import commonProduct from '@/components/commonBanner'
  import selectTab0 from './components/selectTab0'
  import selectTab1 from './components/selectTab1'
  import selectTab2 from './components/selectTab2'
  import selectTab3 from './components/selectTab3'
  export default {
    name: 'index',
    components: {
      commonProduct, selectTab0, selectTab1, selectTab2, selectTab3
    },
    data(){
      return{
        tabData:[
          '公司要闻','行业动态','技术前沿', '团队活动'
        ],
        currentIndex:0,
        tabView:'selectTab0',
        name:'公司要闻'
      }
    },
    methods:{
      changeTab:function (index,item) {
        console.log(index)
        this.currentIndex = index
        this.tabView = 'selectTab'+index
        this.name = item
      }
    }
  }
  </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;
    }
  </style>