Commit a2315167 by 施宇

11111

parent 0494273d
...@@ -19,7 +19,7 @@ const mutations = { ...@@ -19,7 +19,7 @@ const mutations = {
}, },
goodList(state, payload) { goodList(state, payload) {
let arr = []; let arr = [];
for(let k in payload.data){ for (let k in payload.data) {
arr.push(payload.data[k]) arr.push(payload.data[k])
} }
state.goodList = state.goodList.concat(arr) state.goodList = state.goodList.concat(arr)
...@@ -33,7 +33,7 @@ const actions = { ...@@ -33,7 +33,7 @@ const actions = {
let data = res.data; let data = res.data;
if (data.err_code == 0) { if (data.err_code == 0) {
commit("classListM", { commit("classListM", {
data: data.data, data: data.data || [],
}); });
} else { } else {
commit("classListM", { commit("classListM", {
...@@ -55,7 +55,7 @@ const actions = { ...@@ -55,7 +55,7 @@ const actions = {
if (p == 1) { if (p == 1) {
state.goodList = []; state.goodList = [];
} }
let params ={ let params = {
...payload.data, ...payload.data,
limit: 10, limit: 10,
} }
...@@ -63,8 +63,12 @@ const actions = { ...@@ -63,8 +63,12 @@ const actions = {
state.loading = false; state.loading = false;
let data = res.data; let data = res.data;
if (data.err_code == 0) { if (data.err_code == 0) {
let totalPage = Math.ceil(data.data.total / 10); let totalPage = 0;
if (p == totalPage) { if (data.data.total) {
totalPage = Math.ceil(data.data.total / 10);
}
console.log(totalPage)
if (p == totalPage || !totalPage) {
state.finished = true; state.finished = true;
} }
if (data.data.total) { if (data.data.total) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<span>猎芯自营</span> <span>猎芯自营</span>
<font>品现货 1片起订 3小时发货</font> <font>品现货 1片起订 3小时发货</font>
</div> </div>
<div class="nav"> <div class="nav" v-if="classList.length">
<van-tabs <van-tabs
v-model="active" v-model="active"
:color="color" :color="color"
...@@ -117,9 +117,11 @@ export default { ...@@ -117,9 +117,11 @@ export default {
this.loadingYp = now; this.loadingYp = now;
}, },
classList(now) { classList(now) {
this.p = 1; if(now.length){
this.classId = now[0].id; this.p = 1;
this.getGoodList(); this.classId = now[0].id;
this.getGoodList();
}
} }
}, },
created() { created() {
......
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