使用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: { 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',