Authored by 李奇

fixed:分类修改

... ... @@ -2,7 +2,7 @@
<div class="resource-category">
<a-link class="cate-label" :href="brandLink">品牌<i class="icon icon-right"></i></a-link>
<div v-for="(item, index) in sort" v-if="item.sub">
<p class="cate-label" @click="toggle(index)" :name="`item_${index}`">{{item.category_name
<p class="cate-label" @click="toggle(index)">{{item.category_name
}}<i class="icon" :class="sortClass[index]"></i></p>
<div class="cate-items" v-if="show[index]">
<a-link class="cate-item"
... ... @@ -48,36 +48,12 @@ export default {
},
methods: {
toggle(idx) {
this.topCurrent(idx);
for (let i = 0; i < this.show.length; i++) {
if (i !== idx) {
this.$set(this.show, i, false);
this.$set(this.sortClass, i, {
'icon-sort-up': false,
'icon-sort-down': true
});
} else {
this.$set(this.show, i, !this.show[idx]);
this.$set(this.sortClass, i, {
'icon-sort-up': true,
'icon-sort-down': false
});
}
}
this.$set(this.show, idx, !this.show[idx]);
this.$set(this.sortClass, idx, {
'icon-sort-up': this.show[idx],
'icon-sort-down': !this.show[idx]
});
},
topCurrent(idx) {
let $el = document.querySelector(`p[name=item_${idx}]`);
if ($el) {
let top = $el.offsetTop;
document.querySelector('.scroller-box').scrollTop = top;
}
},
getAllSortId(idx) {
return this.value.sort[idx].sub.map(sort=>sort.relation_parameter.sort).join(',') + ',';
}
... ...