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

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

Loading…
Cancel
Save