mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 18:54:11 +08:00
fix(back-button): implements back animation
This commit is contained in:
@ -50,7 +50,7 @@ export class BackButton {
|
||||
ev.preventDefault();
|
||||
nav.pop();
|
||||
} else if (this.defaultHref) {
|
||||
openURL(this.defaultHref, ev);
|
||||
openURL(this.defaultHref, ev, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ export class Router {
|
||||
}
|
||||
|
||||
@Method()
|
||||
pushURL(url: string) {
|
||||
this.writePath(parsePath(url), false);
|
||||
pushURL(url: string, isPop = false) {
|
||||
this.writePath(parsePath(url), isPop);
|
||||
return this.writeNavStateRoot();
|
||||
}
|
||||
|
||||
|
@ -62,12 +62,12 @@ export function getClassMap(classes: string | undefined): CssClassMap {
|
||||
return map;
|
||||
}
|
||||
|
||||
export function openURL(url: string, ev: Event) {
|
||||
export function openURL(url: string, ev: Event, isPop = false) {
|
||||
if (url && url.indexOf('://') === -1) {
|
||||
const router = document.querySelector('ion-router');
|
||||
if (router) {
|
||||
ev && ev.preventDefault();
|
||||
return router.componentOnReady().then(() => router.pushURL(url));
|
||||
return router.componentOnReady().then(() => router.pushURL(url, isPop));
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
|
Reference in New Issue
Block a user