|
@@ -21,8 +21,8 @@
|
|
|
<scroll-view class="scroll-view" :scroll-left="scrollLeft" scroll-x scroll-with-animation>
|
|
|
<view class="tab-box">
|
|
|
<view class="tab-item tabitem" :id="item.classname + item.sa_fadclassid"
|
|
|
- :class="item.sa_fadclassid == sa_fadclassid ? 'tab-item-active' : ''" v-for="item in tabs"
|
|
|
- :key="item.sa_fadclassid" @click="changeActive(item.sa_fadclassid)">
|
|
|
+ :class="item.sa_fadclassid == sa_fadclassid ? 'tab-item-active' : ''" v-for="(item, index) in tabs"
|
|
|
+ :key="item.sa_fadclassid" @click="changeActive(item.sa_fadclassid, index)">
|
|
|
{{ item.classname }}
|
|
|
</view>
|
|
|
</view>
|
|
@@ -48,7 +48,6 @@
|
|
|
</view>
|
|
|
</My_listbox>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -61,6 +60,7 @@ export default {
|
|
|
types: [],
|
|
|
tabs: [],
|
|
|
condition: "",
|
|
|
+ scrollLeft: 0,
|
|
|
"content": {
|
|
|
"where": {
|
|
|
"condition": "",
|
|
@@ -74,7 +74,8 @@ export default {
|
|
|
sa_fadclassid: '',
|
|
|
total: 0,
|
|
|
searchShowAntiShake: null,
|
|
|
- list: []
|
|
|
+ list: [],
|
|
|
+ widths: [0],
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -140,10 +141,22 @@ export default {
|
|
|
if (e.children.length && e.children[0].classname != '全部') e.children.unshift(all)
|
|
|
this.tabs = e.children;
|
|
|
this.active = '全部'
|
|
|
+ this.widths = [0];
|
|
|
+ this.scrollLeft = 0;
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.createSelectorQuery().in(this).selectAll(`.tabitem`).boundingClientRect(list => {
|
|
|
+ let count = 0;
|
|
|
+ list.forEach((v, i) => {
|
|
|
+ if (i) this.widths.push(count)
|
|
|
+ count += v.right;
|
|
|
+ })
|
|
|
+ }).exec();
|
|
|
+ }, 100);
|
|
|
this.$refs.List.setHeight();
|
|
|
this.getList(true)
|
|
|
},
|
|
|
- changeActive(sa_fadclassid) {
|
|
|
+ changeActive(sa_fadclassid, index) {
|
|
|
+ this.scrollLeft = this.widths[index]
|
|
|
if (this.sa_fadclassid == sa_fadclassid) return;
|
|
|
this.sa_fadclassid = sa_fadclassid
|
|
|
this.getList(true)
|