Commit 7098afd2dec15da229a4f8f37b0a00ffb01fd253

Authored by liuqimichale
1 parent 8c48fe84

关于我们 页面建立

Showing 1 changed file with 40 additions and 12 deletions
src/views/about/index.vue
@@ -8,7 +8,8 @@ @@ -8,7 +8,8 @@
8 :key="item" 8 :key="item"
9 @click="changeTab(index,item)" 9 @click="changeTab(index,item)"
10 :class="{tabActive:currentIndex==index}" 10 :class="{tabActive:currentIndex==index}"
11 - >{{item}}</li> 11 + >{{item}}
  12 + </li>
12 </ul> 13 </ul>
13 </div> 14 </div>
14 <div class="bread"> 15 <div class="bread">
@@ -18,29 +19,57 @@ @@ -18,29 +19,57 @@
18 </div> 19 </div>
19 20
20 21
21 - 22 + <div class="widthCommon anchor" style="height: 200px;">1</div>
  23 + <div class="widthCommon anchor" style="height: 400px;">2</div>
  24 + <div class="bgCommon">
  25 + <div class="widthCommon anchor" style="height: 400px;">3</div>
  26 + </div>
  27 + <div class="widthCommon anchor" style="height: 300px;">4</div>
  28 + <div class="widthCommon anchor" style="height: 300px;">5</div>
22 29
23 </div> 30 </div>
24 </template> 31 </template>
25 32
26 <script> 33 <script>
27 import commonBanner from '@/components/commonBanner' 34 import commonBanner from '@/components/commonBanner'
  35 +
28 export default { 36 export default {
29 name: 'index', 37 name: 'index',
30 - components:{ 38 + components: {
31 commonBanner 39 commonBanner
32 }, 40 },
33 - data(){  
34 - return{  
35 - tabData:[  
36 - '智慧停车','公安交通','公共交通' 41 + data() {
  42 + return {
  43 + tabData: [
  44 + '公司简介', '发展历程', '企业文化', '资质认证', '荣誉证书'
37 ], 45 ],
38 - currentIndex:0,  
39 - tabView:'selectTab0',  
40 - name:'智慧停车' 46 + currentIndex: 0,
  47 + tabView: 'selectTab0',
  48 + name: '',
  49 + scroll: ''
41 } 50 }
42 }, 51 },
43 - methods:{ 52 + mounted() {
  53 + this.name = this.tabData[0]
  54 + },
  55 + methods: {
  56 + dataScroll: function () {
  57 + this.scroll = document.documentElement.scrollTop || document.body.scrollTop
  58 + },
  59 + changeTab: function (index, item) {
  60 + console.log(index)
  61 + this.currentIndex = index
  62 + this.tabView = 'selectTab' + index
  63 + this.name = item
  64 +
  65 + // 对应锚点
  66 + let jump = document.getElementsByClassName('anchor')
  67 + let total = jump[index].offsetTop
  68 + document.documentElement.scrollTop = total //firefox
  69 + document.body.scrollTop = total //chrome
  70 + window.pageYOffset = total
  71 +
  72 + },
44 73
45 } 74 }
46 75
@@ -50,5 +79,4 @@ export default { @@ -50,5 +79,4 @@ export default {
50 <style scoped lang="scss"> 79 <style scoped lang="scss">
51 80
52 81
53 -  
54 </style> 82 </style>