mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
25 lines
738 B
TypeScript
25 lines
738 B
TypeScript
import { defineComponent, h, shallowRef, VNode } from 'vue';
|
|
import { VueDelegate } from '../framework-delegate';
|
|
import { defineCustomElement } from '@ionic/core/components/ion-nav.js';
|
|
|
|
export const IonNav = /*@__PURE__*/ defineComponent(() => {
|
|
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',
|
|
{ delegate },
|
|
views.value
|
|
)
|
|
}
|
|
});
|