使用keep alive 缓存组件后,定时器不能销毁的问题

This commit is contained in:
任珮宇 2023-11-08 18:04:41 +08:00
parent 1a45961880
commit 7e637c8c85

View File

@ -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',