Commit b608a19870a3cc3dc12cdbab8e1074bce0b0d4f8

Authored by liuqimichale
1 parent 76c4adef

新闻中心

src/components/commonHeaderFooter/VHeader.vue
@@ -23,6 +23,7 @@ export default { @@ -23,6 +23,7 @@ export default {
23 {name:'首页',pathLink:'/home'}, 23 {name:'首页',pathLink:'/home'},
24 {name:'关于我们',pathLink:'/about'}, 24 {name:'关于我们',pathLink:'/about'},
25 {name:'产品中心',pathLink:'/product'}, 25 {name:'产品中心',pathLink:'/product'},
  26 + {name:'新闻中心',pathLink:'/news'},
26 {name:'联系我们',pathLink:'/contact'}, 27 {name:'联系我们',pathLink:'/contact'},
27 ] 28 ]
28 } 29 }
src/router/index.js
@@ -32,6 +32,11 @@ export default new Router({ @@ -32,6 +32,11 @@ export default new Router({
32 path: '/product', 32 path: '/product',
33 name: 'product', 33 name: 'product',
34 component: () => import('@/views/product') 34 component: () => import('@/views/product')
  35 + },
  36 + {
  37 + path: '/news',
  38 + name: 'news',
  39 + component: () => import('@/views/news')
35 } 40 }
36 41
37 42
src/views/news/components/selectTab0.vue 0 → 100644
  1 +<template>
  2 + <div>1</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 + name: 'selectTab0'
  8 +}
  9 +</script>
  10 +
  11 +<style scoped lang="scss">
  12 +
  13 +</style>
src/views/news/components/selectTab1.vue 0 → 100644
  1 +<template>
  2 + <div>1</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 + name: 'selectTab1'
  8 +}
  9 +</script>
  10 +
  11 +<style scoped lang="scss">
  12 +
  13 +</style>
src/views/news/components/selectTab2.vue 0 → 100644
  1 +<template>
  2 + <div>2</div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 + name: 'selectTab2'
  8 +}
  9 +</script>
  10 +
  11 +<style scoped lang="scss">
  12 +
  13 +</style>
src/views/news/components/selectTab3.vue 0 → 100644
  1 +<template>
  2 + <div></div>
  3 +</template>
  4 +
  5 +<script>
  6 +export default {
  7 + name: 'selectTab3'
  8 +}
  9 +</script>
  10 +
  11 +<style scoped lang="scss">
  12 +
  13 +</style>
src/views/news/index.vue 0 → 100644
  1 +<template>
  2 + <div>
  3 + <commonProduct mainTitle="中兴智能交通" subTitle="构建绿色交通 享受安全便利出行"></commonProduct>
  4 + <div class="tab-wrapper">
  5 + <ul class="tab-main widthCommon">
  6 + <li
  7 + v-for="(item, index) in tabData"
  8 + :key="item"
  9 + @click="changeTab(index,item)"
  10 + :class="{tabActive:currentIndex==index}"
  11 + >{{item}}</li>
  12 + </ul>
  13 + </div>
  14 + <div class="bread ">
  15 + <div class=" widthCommon">
  16 + 您所在位置: <span class="pointer" @click="$router.push({name:'home'})">首页</span> -> 新闻中心 -> {{name}}
  17 + </div>
  18 + </div>
  19 + <div class="widthCommon">
  20 + <keep-alive>
  21 + <component :is="tabView"></component>
  22 + </keep-alive>
  23 + </div>
  24 +
  25 + </div>
  26 +</template>
  27 +
  28 +<script>
  29 +import commonProduct from '@/components/commonBanner'
  30 +import selectTab0 from './components/selectTab0'
  31 +import selectTab1 from './components/selectTab1'
  32 +import selectTab2 from './components/selectTab2'
  33 +import selectTab3 from './components/selectTab3'
  34 +export default {
  35 + name: 'index',
  36 + components: {
  37 + commonProduct, selectTab0, selectTab1, selectTab2, selectTab3
  38 + },
  39 + data(){
  40 + return{
  41 + tabData:[
  42 + '公司要闻','行业动态','技术前沿', '团队活动'
  43 + ],
  44 + currentIndex:0,
  45 + tabView:'selectTab0',
  46 + name:'公司要闻'
  47 + }
  48 + },
  49 + methods:{
  50 + changeTab:function (index,item) {
  51 + console.log(index)
  52 + this.currentIndex = index
  53 + this.tabView = 'selectTab'+index
  54 + this.name = item
  55 + }
  56 + }
  57 +}
  58 +</script>
  59 +
  60 +<style scoped lang="scss">
  61 + .tab-wrapper{
  62 + height:50px;
  63 + background:rgba(237,237,237,1);
  64 + /*line-height: 50px;*/
  65 + padding-top: 5px;
  66 + }
  67 + .tab-main{
  68 + padding-left: 100px;
  69 + height: 45px;
  70 + line-height: 45px;
  71 + }
  72 + .tab-main li{
  73 + float: left;
  74 + margin-right: 50px;
  75 + width: 125px;
  76 +
  77 + border-radius: 5px;
  78 + color: #333;
  79 + font-size: 16px;
  80 + text-align: center;
  81 + cursor: pointer;
  82 + }
  83 + .tabActive{
  84 + background: #FFF;
  85 + }
  86 +</style>
src/views/product/index.vue
@@ -6,14 +6,14 @@ @@ -6,14 +6,14 @@
6 <li 6 <li
7 v-for="(item, index) in tabData" 7 v-for="(item, index) in tabData"
8 :key="item" 8 :key="item"
9 - @click="changeTab(index)" 9 + @click="changeTab(index,item)"
10 :class="{tabActive:currentIndex==index}" 10 :class="{tabActive:currentIndex==index}"
11 >{{item}}</li> 11 >{{item}}</li>
12 </ul> 12 </ul>
13 </div> 13 </div>
14 <div class="bread"> 14 <div class="bread">
15 <div class=" widthCommon"> 15 <div class=" widthCommon">
16 - 您所在位置: <span class="pointer" @click="$router.push({name:'home'})">首页</span> -> 产品中心 -> 智慧停车 16 + 您所在位置: <span class="pointer" @click="$router.push({name:'home'})">首页</span> -> 产品中心 -> {{name}}
17 </div> 17 </div>
18 </div> 18 </div>
19 19
@@ -41,14 +41,16 @@ export default { @@ -41,14 +41,16 @@ export default {
41 '智慧停车','公安交通','公共交通' 41 '智慧停车','公安交通','公共交通'
42 ], 42 ],
43 currentIndex:0, 43 currentIndex:0,
44 - tabView:'selectTab0' 44 + tabView:'selectTab0',
  45 + name:'智慧停车'
45 } 46 }
46 }, 47 },
47 methods:{ 48 methods:{
48 - changeTab:function (index) { 49 + changeTab:function (index,item) {
49 console.log(index) 50 console.log(index)
50 this.currentIndex = index 51 this.currentIndex = index
51 this.tabView = 'selectTab'+index 52 this.tabView = 'selectTab'+index
  53 + this.name = item
52 } 54 }
53 } 55 }
54 56