修复切换页面,盘点接口让然请求的问题

taiwan-tingli
yiming 4 years ago
parent 35840fc12e
commit 934a3a35ae

@ -131,7 +131,7 @@ export default {
return parseInt(this.total.column / this.nums.column) + (this.total.column % this.nums.column > 0 ? 1 : 0);
},
random() {
console.log(this.getRandomRow(this.select.row))
return {
row: this.getRandomRow(this.select.row),
@ -146,8 +146,9 @@ export default {
watchShelveIdInfo() {
this.getStatus();
},
immediate: true
immediate: true,
},
data() {
return {
@ -156,23 +157,20 @@ export default {
column: {}
},
timer: null
}
},
mounted() {
this.$nextTick(() => {
this.getStatus();
})
this.timer = window.setInterval(this.getStatus, 5000);
this.$once('hook:beforeDestroy', () => {//
console.log('hook:beforeDestroy')
window.clearInterval(this.timer);//
this.timer = null;
});
this.timer = window.setInterval(this.getStatus, 3000);
this.$on('hook:deactivated', () => {
clearInterval(this.timer)
this.timer = null
})
},
beforeDestroy() {
console.log("beforeDestroy")
window.clearInterval(this.timer);
@ -184,6 +182,7 @@ export default {
destroyed() {
clearInterval(this.timer);
},
methods: {
changeTab(value){
this.select.column = value

@ -95,8 +95,7 @@ export default {
left: {},
right: {}
},
timer: null,
leftShelveId:{},
rightShelveId:{}
}
@ -121,10 +120,7 @@ export default {
this.request();
}
},
// beforeRouteLeave(to, form, next) {
// this.timer && clearInterval(this.timer);
// next();
// },
methods: {
//
request() {
@ -136,10 +132,10 @@ export default {
}).then(res => {
console.log("update data")
for(let i = 0;i<res.data.list.length;i++){
console.log(res.data.list[i])
this.$set(this.data,i,res.data.list[i])
}
console.log(this.data)
this.select = res.data.list[0].id
//this.$set(this.select,res.data.list[0].id,0)
this.getStreetDetail(this.select);

Loading…
Cancel
Save