1
|
<template>
|
1
|
<template>
|
2
|
<div class="brand-list-box">
|
2
|
<div class="brand-list-box">
|
3
|
<div v-for="(item, index) in brandList" :key="index" class="per-brand-box">
|
3
|
<div v-for="(item, index) in brandList" :key="index" class="per-brand-box">
|
4
|
- <div class="index"><a :href="'#' + item.index" :name="item.index">{{item.index}}</a></div>
|
4
|
+ <div class="index"><a :href="'#' + item.index" :id="item.index" :name="item.index">{{item.index}}</a></div>
|
5
|
<div class="brand-big-box clearfix">
|
5
|
<div class="brand-big-box clearfix">
|
6
|
<div class="brand-box" v-for="brand in item.brands" :key="brand.name">
|
6
|
<div class="brand-box" v-for="brand in item.brands" :key="brand.name">
|
7
|
<a v-brand-href="brand.domain">
|
7
|
<a v-brand-href="brand.domain">
|
|
@@ -10,7 +10,7 @@ |
|
@@ -10,7 +10,7 @@ |
10
|
</div>
|
10
|
</div>
|
11
|
</div>
|
11
|
</div>
|
12
|
</div>
|
12
|
</div>
|
13
|
- <index-list class="index-list" :index-list="indexList"></index-list>
|
13
|
+ <index-list class="index-list" :index-list="indexList" @loc-index="locIndex"></index-list>
|
14
|
</div>
|
14
|
</div>
|
15
|
</template>
|
15
|
</template>
|
16
|
<style>
|
16
|
<style>
|
|
@@ -141,6 +141,19 @@ |
|
@@ -141,6 +141,19 @@ |
141
|
}).fail(() => {
|
141
|
}).fail(() => {
|
142
|
tip('网络错误');
|
142
|
tip('网络错误');
|
143
|
});
|
143
|
});
|
|
|
144
|
+ },
|
|
|
145
|
+ locIndex(index) {
|
|
|
146
|
+ let $el = document.querySelector(`a[name="${index}"]`);
|
|
|
147
|
+
|
|
|
148
|
+ if ($el) {
|
|
|
149
|
+ let top = document.querySelector(`a[name=${index}]`).offsetTop;
|
|
|
150
|
+ let header = document.querySelector('.blk-header');
|
|
|
151
|
+
|
|
|
152
|
+ if (header) {
|
|
|
153
|
+ top -= header.clientHeight + 2;
|
|
|
154
|
+ }
|
|
|
155
|
+ window.scrollTo(0, top);
|
|
|
156
|
+ }
|
144
|
}
|
157
|
}
|
145
|
},
|
158
|
},
|
146
|
components: {
|
159
|
components: {
|