Commit 14be3504 by LJM

js

parent 85085964
......@@ -12,7 +12,7 @@
<text class="icon iconfont icon-car"></text>
<view>
购物车
<text class="counts">{{count}}</text>
<text class="counts">{{ count }}</text>
</view>
</navigator>
<navigator url="/user" class="navitem" :class="{ act: actval == 4 }">
......@@ -23,7 +23,7 @@
</template>
<script>
import {Ichunt_Api,Api_Url} from '@/util/api.js';
import { Ichunt_Api, Api_Url } from '@/util/api.js';
export default {
name: 'bottom_nav',
props: {
......@@ -31,32 +31,30 @@ export default {
type: String,
default: 1
},
carcount: {
type: Number,
default: 0
}
carcount: {
type: Number,
default: 0
}
},
created() {
this.getData();
},
created() {
this.getData();
},
data() {
return {
count:0
};
count: 0
};
},
methods: {
getData() {
this.request(Api_Url + "/cart/count", 'POST', {},false,true ).then(res => {
if (res.err_code === 0) {
this.count=res.data;
console.log(this.carcount)
if(this.carcount){
this.count=this.carcount
}
}
});
}
this.request(Api_Url + '/cart/count', 'POST', {}, false, true).then(res => {
if (res.err_code === 0) {
this.count = res.data;
if (this.carcount) {
this.count = this.carcount;
}
}
});
}
}
};
</script>
......
......@@ -22,13 +22,23 @@ Vue.use(directive);
//定义全局变量
var globalData = {
kefu: '' //客服
SEARCH_SUPPLIER_SINGLE: '',
global_contact_us: '',
h5_home_activity_recommend: '',
h5_home_hide_menu: '',
h5_home_hot_search_goods: '',
kfqq_xk: ''
};
//读取全局变量配置
request(Ichunt_Api + '/api/common/data', 'GET', {}, true, true).then(res => {
if (res.err_code === 0) {
globalData.kefu = res.data.kfqq_xk.data;
globalData.SEARCH_SUPPLIER_SINGLE = res.data.SEARCH_SUPPLIER_SINGLE;
globalData.global_contact_us = res.data.global_contact_us;
globalData.h5_home_activity_recommend = res.data.h5_home_activity_recommend;
globalData.h5_home_hide_menu = res.data.h5_home_hide_menu;
globalData.h5_home_hot_search_goods = res.data.h5_home_hot_search_goods;
globalData.kfqq_xk = res.data.kfqq_xk.data;
Vue.prototype.$globalData = globalData;
}
});
......
......@@ -173,7 +173,8 @@ export default {
};
},
onLoad() {
this.kfqq_xk = this.$globalData && this.$globalData.kefu;
console.log(this.$globalData);
this.kfqq_xk = this.$globalData && this.$globalData.kfqq_xk;
},
onShow() {
this.getData();
......
......@@ -125,9 +125,11 @@ export default {
activity_list: []
};
},
onLoad() {
this.kfqq_xk = this.$globalData && this.$globalData.kfqq_xk;
},
onShow() {
this.getData();
this.kfqq_xk = this.$globalData && this.$globalData.kefu;
},
methods: {
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment