yiming 4 years ago
commit 0af7ffa8e8

@ -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),
@ -147,7 +147,8 @@ export default {
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, 3000);
this.timer = window.setInterval(this.getStatus, 5000);
this.$once('hook:beforeDestroy', () => {//
console.log('hook:beforeDestroy')
window.clearInterval(this.timer);//
this.timer = null;
});
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

@ -21,7 +21,7 @@
<div style="margin-top: 10px">
<a-select :default-value="data[0].name"
@change="handleChange" class="select-roadway">
@change="handleChange" style="width:200px">
<a-select-option v-for="i in data" :key="i.name" :value="i.id">
{{i.name}}
</a-select-option>
@ -95,7 +95,6 @@ export default {
left: {},
right: {}
},
timer: null,
leftShelveId:{},
rightShelveId:{}
@ -118,12 +117,10 @@ export default {
this.request();//
}else{
console.log("$route.meta.isUseCache true")
this.request();
}
},
// beforeRouteLeave(to, form, next) {
// this.timer && clearInterval(this.timer);
// next();
// },
methods: {
//
request() {
@ -135,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