mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
fix(vue): back button handler only fires in routing context (#26014)
This commit is contained in:
@ -10,6 +10,12 @@ export const IonBackButton = /*@__PURE__*/ defineComponent((_, { attrs, slots })
|
|||||||
const ionRouter: any = inject('navManager');
|
const ionRouter: any = inject('navManager');
|
||||||
|
|
||||||
const onClick = () => {
|
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 defaultHref = attrs['default-href'] || attrs['defaultHref'];
|
||||||
const routerAnimation = attrs['router-animation'] || attrs['routerAnimation'];
|
const routerAnimation = attrs['router-animation'] || attrs['routerAnimation'];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user