fix(vue): back button handler only fires in routing context (#26014)

This commit is contained in:
Liam DeBeasi
2022-09-27 08:18:41 -05:00
committed by GitHub
parent cabd23ef81
commit 19f0fb7045

View File

@ -10,6 +10,12 @@ export const IonBackButton = /*@__PURE__*/ defineComponent((_, { attrs, slots })
const ionRouter: any = inject('navManager');
const onClick = () => {
/**
* When using ion-back-button outside of
* a routing context, ionRouter is undefined.
*/
if (ionRouter === undefined) { return; }
const defaultHref = attrs['default-href'] || attrs['defaultHref'];
const routerAnimation = attrs['router-animation'] || attrs['routerAnimation'];