@meve/ui
Version:
Argon design system components library
12 lines • 426 B
JavaScript
export function createRouterMixin() {
return {
mounted: function mounted() {
window.addEventListener('hashchange', this.handleRouteChange);
window.addEventListener('popstate', this.handleRouteChange);
},
beforeDestroy: function beforeDestroy() {
window.removeEventListener('hashchange', this.handleRouteChange);
window.removeEventListener('popstate', this.handleRouteChange);
}
};
}