Authored by 郭成尧

'tab切换'

... ... @@ -209,10 +209,19 @@
const qs = require('yoho-qs');
const bus = require('common/vue-bus');
const genderCode = {
MEN男士: '1,3',
WOMEN女士: '2,3',
LIFESTYLE生活: '1,2,3'
const channelTrans = {
men: {
key: 'MEN男士',
code: '1,3'
},
women: {
key: 'WOMEN女士',
code: '2,3'
},
lifestyle: {
key: 'LIFESTYLE生活',
code: '1,2,3'
}
};
module.exports = {
... ... @@ -232,6 +241,8 @@
},
methods: {
getCateList() {
let self = this;
let data = {
channel: ''
};
... ... @@ -241,9 +252,9 @@
data: data
}).then(result => {
if (result) {
this.brandCate = result;
this.cateNavLeftData = result['MEN男士'];
this.cateNavRightData = result['MEN男士'][0].sub;
self.$set('brandCate', result);
self.$set('cateNavLeftData', result['MEN男士']);
self.$set('cateNavRightData', result['MEN男士'][0].sub);
}
}).fail(() => {
tip('网络错误');
... ... @@ -258,13 +269,14 @@
tab
},
created() {
const self = this;
this.getCateList();
bus.$on('channel.change', function(index) {
this.topcurrent = index;
this.gender = genderCode[index];
this.cateNavLeftData = this.brandCate[index];
this.cateNavRightData = this.cateNavLeftData[0].sub;
bus.$on('channel.change', function(page, channel) {
self.gender = channelTrans[channel].code;
self.cateNavLeftData = self.brandCate[channelTrans[channel].key];
self.cateNavRightData = self.cateNavLeftData[0].sub;
});
}
};
... ...