Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 记录最后一个location,浏览器前进后退按钮用
lastLocation = {...nextState.location}
stateKey = Number(nextState.location.state!.key)
serialize()
history.length = globalHistory.length
const params = {
fromLocation,
toLocation: history.location,
action: history.action
}
Taro._$router = history.location
Taro.eventCenter.trigger('__taroRouterChange', {...params})
transitionManager.notifyListeners({...params})
}
this.listeners.forEach(([evtName, callback]) => {
Taro.eventCenter.off(evtName, callback)
})
}
this.listeners.forEach(([evtName, callback]) => {
Taro.eventCenter.on(evtName, callback)
})
}
removeEvent () {
Taro.eventCenter.off('__taroRouterChange', this.routerChangeHandler)
Taro.eventCenter.off('__taroSwitchTab', this.switchTabHandler)
Taro.eventCenter.off('__taroSetTabBarBadge', this.setTabBarBadgeHandler)
Taro.eventCenter.off('__taroRemoveTabBarBadge', this.removeTabBarBadgeHandler)
Taro.eventCenter.off('__taroShowTabBarRedDotHandler', this.showTabBarRedDotHandler)
Taro.eventCenter.off('__taroHideTabBarRedDotHandler', this.hideTabBarRedDotHandler)
Taro.eventCenter.off('__taroShowTabBarHandler', this.showTabBarHandler)
Taro.eventCenter.off('__taroHideTabBarHandler', this.hideTabBarHandler)
}
removeEvent () {
Taro.eventCenter.off('__taroRouterChange', this.routerChangeHandler)
Taro.eventCenter.off('__taroSwitchTab', this.switchTabHandler)
Taro.eventCenter.off('__taroSetTabBarBadge', this.setTabBarBadgeHandler)
Taro.eventCenter.off('__taroRemoveTabBarBadge', this.removeTabBarBadgeHandler)
Taro.eventCenter.off('__taroShowTabBarRedDotHandler', this.showTabBarRedDotHandler)
Taro.eventCenter.off('__taroHideTabBarRedDotHandler', this.hideTabBarRedDotHandler)
Taro.eventCenter.off('__taroShowTabBarHandler', this.showTabBarHandler)
Taro.eventCenter.off('__taroHideTabBarHandler', this.hideTabBarHandler)
}