mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00

Issue number: fixes #30179 --------- ## What is the current behavior? There have been issues reported on version 8.4.3 related to the type information changing for Vue ## What is the new behavior? This patch updates the Vue components to be correctly types using a new version of the output target. ## Does this introduce a breaking change? - [ ] Yes - [x] No
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import type { JSX, AnimationBuilder } from "@ionic/core/components";
|
|
import { defineCustomElement } from "@ionic/core/components/ion-nav.js";
|
|
import type { VNode, PropType } from "vue";
|
|
import { defineComponent, h, shallowRef } from "vue";
|
|
|
|
import { VueDelegate } from "../framework-delegate";
|
|
|
|
export const IonNav = /*@__PURE__*/ defineComponent<JSX.IonNav>(
|
|
(props: JSX.IonNav) => {
|
|
defineCustomElement();
|
|
const views = shallowRef([]);
|
|
|
|
/**
|
|
* Allows us to create the component
|
|
* within the Vue application context.
|
|
*/
|
|
const addView = (component: VNode) =>
|
|
(views.value = [...views.value, component]);
|
|
const removeView = (component: VNode) =>
|
|
(views.value = views.value.filter((cmp) => cmp !== component));
|
|
|
|
const delegate = VueDelegate(addView, removeView);
|
|
return () => {
|
|
return h("ion-nav", { ...props, delegate }, views.value);
|
|
};
|
|
},
|
|
{
|
|
name: "IonNav",
|
|
/**
|
|
* The default values follow what is defined at
|
|
* https://ionicframework.com/docs/api/nav#properties
|
|
* otherwise the default values on the Web Component
|
|
* may be overridden. For example, if the default animated value
|
|
* is not `true` below, then Vue would default the prop to `false`
|
|
* which would override the Web Component default of `true`.
|
|
*/
|
|
props: {
|
|
animated: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
animation: {
|
|
type: Function as unknown as PropType<AnimationBuilder>,
|
|
default: undefined,
|
|
},
|
|
root: {
|
|
type: [Function, Object, String],
|
|
default: undefined,
|
|
},
|
|
rootParams: {
|
|
type: Object,
|
|
default: undefined,
|
|
},
|
|
swipeGesture: {
|
|
type: Boolean,
|
|
default: undefined,
|
|
},
|
|
},
|
|
}
|
|
);
|