mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +08:00

This patch includes some necessary updates for `@stencil/vue-output-target@v0.9.0`: - we started to export Stencils helpers as runtime via `@stencil/vue-output-target/runtime` similar to what we did in React - this version requires some updates to Vue and TypeScript as well - adjustments related to that update
42 lines
998 B
TypeScript
42 lines
998 B
TypeScript
import { defineCustomElement } from "@ionic/core/components/ion-back-button.js";
|
|
import { h, inject, defineComponent } from "vue";
|
|
|
|
export const IonBackButton = /*@__PURE__*/ defineComponent(
|
|
(_, { attrs, slots }) => {
|
|
defineCustomElement();
|
|
|
|
// TODO(FW-2969): type
|
|
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"];
|
|
|
|
ionRouter.handleNavigateBack(defaultHref, routerAnimation);
|
|
};
|
|
|
|
return () => {
|
|
return h(
|
|
"ion-back-button",
|
|
{
|
|
onClick,
|
|
...attrs,
|
|
},
|
|
slots.default && slots.default()
|
|
);
|
|
};
|
|
},
|
|
{
|
|
name: "IonBackButton",
|
|
}
|
|
);
|