使用keep alive 缓存组件后,定时器不能销毁的问题
This commit is contained in:
parent
1a45961880
commit
7e637c8c85
|
@ -184,16 +184,23 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
$route: {
|
$route: {
|
||||||
handler: function (val, oldVal) {
|
handler: function (val, oldVal) {
|
||||||
if (val.name !== 'station-operation') {
|
console.log('fasdfasde12312', val)
|
||||||
this.$message.destroy()
|
console.log('8765432', oldVal)
|
||||||
clearInterval(this.timer)
|
if (val.name === 'station-operation') {
|
||||||
this.timer = null
|
this.getDataProvisionEfficiency(this.markerList_clone)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
// immediate: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
deactivated() {
|
||||||
|
//等同于 销毁的生命周期
|
||||||
|
console.log('切换出发了3')
|
||||||
|
this.$message.destroy()
|
||||||
|
clearInterval(this.timer)
|
||||||
|
this.timer = null
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
activeKey: '1',
|
activeKey: '1',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user