feat(router): 增强路由组件加载逻辑
1. 修改卸载timer、event、script的逻辑 2. 修改加载script的逻辑
This commit is contained in:
@@ -45,11 +45,19 @@ export class TimerManager {
|
||||
}
|
||||
|
||||
cleanAll() {
|
||||
console.log('cleanAll time or interval');
|
||||
this.timers.forEach((timerId) => {
|
||||
window.clearTimeout(timerId);
|
||||
window.clearInterval(timerId);
|
||||
return new Promise((resolve, reject) => {
|
||||
this.timers.onload = () => {
|
||||
this.timers.forEach((timerId) => {
|
||||
window.clearTimeout(timerId);
|
||||
window.clearInterval(timerId);
|
||||
});
|
||||
resolve();
|
||||
};
|
||||
this.timers.onerror = () => {
|
||||
console.log('unload timer error');
|
||||
reject();
|
||||
}
|
||||
this.timers = [];
|
||||
});
|
||||
this.timers = [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user