diff --git a/src/views/checkManage/Subsection.vue b/src/views/checkManage/Subsection.vue index a06e63f..53fa68c 100644 --- a/src/views/checkManage/Subsection.vue +++ b/src/views/checkManage/Subsection.vue @@ -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 diff --git a/src/views/checkManage/index.vue b/src/views/checkManage/index.vue index 93e0918..004f71e 100644 --- a/src/views/checkManage/index.vue +++ b/src/views/checkManage/index.vue @@ -21,7 +21,7 @@
+ @change="handleChange" style="width:200px"> {{i.name}} @@ -95,8 +95,7 @@ export default { left: {}, right: {} }, - timer: null, - + leftShelveId:{}, rightShelveId:{} } @@ -117,13 +116,11 @@ export default { // 清空原有数据 this.request();// 这是我们获取数据的函数 }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: { //获取巷道列表 request() { @@ -135,10 +132,10 @@ export default { }).then(res => { console.log("update data") for(let i = 0;i