Commit 14be3504 by LJM

js

parent 85085964
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<text class="icon iconfont icon-car"></text> <text class="icon iconfont icon-car"></text>
<view> <view>
购物车 购物车
<text class="counts">{{count}}</text> <text class="counts">{{ count }}</text>
</view> </view>
</navigator> </navigator>
<navigator url="/user" class="navitem" :class="{ act: actval == 4 }"> <navigator url="/user" class="navitem" :class="{ act: actval == 4 }">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</template> </template>
<script> <script>
import {Ichunt_Api,Api_Url} from '@/util/api.js'; import { Ichunt_Api, Api_Url } from '@/util/api.js';
export default { export default {
name: 'bottom_nav', name: 'bottom_nav',
props: { props: {
...@@ -31,32 +31,30 @@ export default { ...@@ -31,32 +31,30 @@ export default {
type: String, type: String,
default: 1 default: 1
}, },
carcount: { carcount: {
type: Number, type: Number,
default: 0 default: 0
} }
},
created() {
this.getData();
}, },
created() {
this.getData();
},
data() { data() {
return { return {
count:0 count: 0
}; };
}, },
methods: { methods: {
getData() { getData() {
this.request(Api_Url + "/cart/count", 'POST', {},false,true ).then(res => { this.request(Api_Url + '/cart/count', 'POST', {}, false, true).then(res => {
if (res.err_code === 0) { if (res.err_code === 0) {
this.count=res.data; this.count = res.data;
console.log(this.carcount) if (this.carcount) {
if(this.carcount){ this.count = this.carcount;
this.count=this.carcount }
} }
} });
}); }
}
} }
}; };
</script> </script>
......
...@@ -22,13 +22,23 @@ Vue.use(directive); ...@@ -22,13 +22,23 @@ Vue.use(directive);
//定义全局变量 //定义全局变量
var globalData = { 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 => { request(Ichunt_Api + '/api/common/data', 'GET', {}, true, true).then(res => {
if (res.err_code === 0) { 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; Vue.prototype.$globalData = globalData;
} }
}); });
......
...@@ -173,7 +173,8 @@ export default { ...@@ -173,7 +173,8 @@ export default {
}; };
}, },
onLoad() { onLoad() {
this.kfqq_xk = this.$globalData && this.$globalData.kefu; console.log(this.$globalData);
this.kfqq_xk = this.$globalData && this.$globalData.kfqq_xk;
}, },
onShow() { onShow() {
this.getData(); this.getData();
......
...@@ -125,9 +125,11 @@ export default { ...@@ -125,9 +125,11 @@ export default {
activity_list: [] activity_list: []
}; };
}, },
onLoad() {
this.kfqq_xk = this.$globalData && this.$globalData.kfqq_xk;
},
onShow() { onShow() {
this.getData(); this.getData();
this.kfqq_xk = this.$globalData && this.$globalData.kefu;
}, },
methods: { 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