Authored by 陈轩

save

... ... @@ -10,7 +10,7 @@
<li class="filter-cate" v-for="classify in config" @click="entrySub($key)">
<i class="icon icon-right right"></i>
<span class="filter-cate-label">{{$key | filter-en-cn }}</span>
<span class="filter-cate-val">{{params[$key] && params[$key].name }}</span>
<span class="filter-cate-val">{{showLabel($key)}}</span>
</li>
</ul>
</div>
... ... @@ -50,26 +50,21 @@
this.overlay.show();
} else {
this.overlay.hide();
this.$set('params', {});
}
}
},
methods: {
clearVals: function() {
// remove all value
this.$set('selected', {});
this.$set('params', {});
},
/**
* 当二级筛选, 返回数据时, 调用该方法
* @param {[type]} cate [description]
* @param {[type]} val [description]
*/
setCateParams: function(cate, val) {
this.$set(`params.${cate}`, val);
},
okAction: function() {
this.$set('selected', Object.assign({}, this.selected,this.params));
bus.$emit('filter.change', {
val: this.params,
val: this.selected,
ref: this._uid
});
},
... ... @@ -78,8 +73,24 @@
this.$refs.filterSub.isVisible = true;
},
/**
* 当二级筛选, 返回数据时, 调用该方法
* @param {[type]} cate [description]
* @param {[type]} val [description]
*/
setParams: function(item) {
this.$set(`params.${this.subType}`, item);
},
showLabel: function(key){
const newSelected = this.params[key];
const oldSelected = this.selected[key];
if(newSelected) {
return newSelected.name || '';
} else {
return oldSelected && oldSelected.name || '';
}
}
},
filters: {
... ...