|
|
<template>
|
|
|
<div class="top-filter clearfix">
|
|
|
<div class="filter-overlay" v-show="layFlag"></div>
|
|
|
<div class="filter-content">
|
|
|
<ul class="filter-type">
|
|
|
<li class="type-item" @click="toggleRec">{{activeSort.text}}<i class="icon" :class="recClass"></i></li>
|
|
|
<li class="type-item" @click="toggleFilter">筛选<i class="icon" :class="filterClass"></i></li>
|
...
|
...
|
@@ -14,8 +16,9 @@ |
|
|
<filter-item v-for="item in filterItems" :name="item.name" :choices="item.choices"></filter-item>
|
|
|
<div class="action">
|
|
|
<p class="tip">您可以选择一个或多个筛选项进行筛选</p>
|
|
|
<a class="action-btn filter-btn">筛选</a>
|
|
|
<a class="action-btn clear-btn">清空</a>
|
|
|
<a class="action-btn filter-btn" @click="filterSearch">筛选</a>
|
|
|
<a class="action-btn clear-btn" @click="clearFilter">清空</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -51,34 +54,29 @@ module.exports = { |
|
|
filterItems: [
|
|
|
{
|
|
|
name: '品牌',
|
|
|
val: '',
|
|
|
choices: this.filter.brand
|
|
|
}, {
|
|
|
name: '品类',
|
|
|
val: '',
|
|
|
choices: []
|
|
|
}, {
|
|
|
name: '颜色',
|
|
|
val: '',
|
|
|
choices: this.filter.color
|
|
|
}, {
|
|
|
name: '尺寸',
|
|
|
val: '',
|
|
|
choices: this.filter.size
|
|
|
}, {
|
|
|
name: '价格',
|
|
|
val: '',
|
|
|
choices: this.filter.priceRange
|
|
|
}, {
|
|
|
name: '折扣',
|
|
|
val: '',
|
|
|
choices: this.filter.discount
|
|
|
}
|
|
|
],
|
|
|
activeSort: {
|
|
|
text: '推荐',
|
|
|
order: ''
|
|
|
}
|
|
|
},
|
|
|
layFlag: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
...
|
...
|
@@ -101,7 +99,6 @@ module.exports = { |
|
|
toggleRec(){
|
|
|
this.filterDown = true;
|
|
|
this.recDown = !this.recDown;
|
|
|
|
|
|
},
|
|
|
toggleFilter(){
|
|
|
this.recDown = true;
|
...
|
...
|
@@ -121,6 +118,45 @@ module.exports = { |
|
|
ref: this._uid
|
|
|
});
|
|
|
this.recDown = true;
|
|
|
},
|
|
|
showLay() {
|
|
|
this.bodyElStyle = document.querySelector('body').style;
|
|
|
this.bodyElStyle.position = 'absolute';
|
|
|
this.bodyElStyle.top = 0;
|
|
|
this.bodyElStyle.left = 0;
|
|
|
this.bodyElStyle.right = 0;
|
|
|
this.bodyElStyle.bottom = 0;
|
|
|
this.bodyElStyle.overflow = 'hidden';
|
|
|
this.layFlag = true;
|
|
|
},
|
|
|
hideLay() {
|
|
|
this.bodyElStyle.position = 'static';
|
|
|
this.bodyElStyle.overflow = 'auto';
|
|
|
this.layFlag = false;
|
|
|
},
|
|
|
filterSearch(){
|
|
|
|
|
|
},
|
|
|
clearFilter(){
|
|
|
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
recDown(val){
|
|
|
if (val) {
|
|
|
this.hideLay();
|
|
|
return;
|
|
|
} else {
|
|
|
this.showLay();
|
|
|
}
|
|
|
|
|
|
},
|
|
|
filterDown(val){
|
|
|
if (val) {
|
|
|
return this.hideLay();
|
|
|
}
|
|
|
|
|
|
this.showLay();
|
|
|
}
|
|
|
},
|
|
|
components: {
|
...
|
...
|
@@ -134,7 +170,9 @@ module.exports = { |
|
|
|
|
|
this.filterItems[1].choices = temp;
|
|
|
|
|
|
console.log(temp)
|
|
|
bus.$on('filter.choice.change', choice => {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
};
|
|
|
</script>
|
...
|
...
|
@@ -144,12 +182,29 @@ module.exports = { |
|
|
.top-filter {
|
|
|
position: relative;
|
|
|
height: 81px;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
.filter-overlay {
|
|
|
position: fixed;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
bottom: 0;
|
|
|
opacity: .5;
|
|
|
background-color: #000;
|
|
|
}
|
|
|
|
|
|
.filter-content {
|
|
|
position: relative;
|
|
|
background-color: #fff;
|
|
|
}
|
|
|
|
|
|
.filter-type {
|
|
|
font-size: 0;
|
|
|
list-style: none;
|
|
|
height: 79px;
|
|
|
background-color: #fff;
|
|
|
padding: 16px 30px 0;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
.type-item {
|
|
|
display: inline-block;
|
...
|
...
|
@@ -179,7 +234,7 @@ module.exports = { |
|
|
|
|
|
.rec-detail {
|
|
|
position: absolute;
|
|
|
top: 81px;
|
|
|
top: 79px;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
|
...
|
...
|
@@ -192,6 +247,10 @@ module.exports = { |
|
|
background-color: #fff;
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
&:last-child {
|
|
|
border-bottom: none;
|
|
|
}
|
|
|
|
|
|
&.active {
|
|
|
background: $grey;
|
|
|
}
|
...
|
...
|
@@ -200,7 +259,7 @@ module.exports = { |
|
|
|
|
|
.filter-detail {
|
|
|
position: absolute;
|
|
|
top: 81px;
|
|
|
top: 79px;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
height: 950px;
|
...
|
...
|
|