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