mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
feat(vue): add ionic vue beta (#22062)
This commit is contained in:
26
packages/vue/src/ionic-vue.ts
Normal file
26
packages/vue/src/ionic-vue.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { App, Plugin } from 'vue';
|
||||
import { IonicConfig, setupConfig } from '@ionic/core';
|
||||
import { applyPolyfills, defineCustomElements } from '@ionic/core/loader';
|
||||
|
||||
const ael = (el: any, eventName: string, cb: any, opts: any) => el.addEventListener(eventName.toLowerCase(), cb, opts);
|
||||
const rel = (el: any, eventName: string, cb: any, opts: any) => el.removeEventListener(eventName.toLowerCase(), cb, opts);
|
||||
|
||||
export const IonicVue: Plugin = {
|
||||
|
||||
async install(_app: App, config: IonicConfig = {}) {
|
||||
if (typeof (window as any) !== 'undefined') {
|
||||
setupConfig({
|
||||
...config,
|
||||
_ael: ael,
|
||||
_rel: rel,
|
||||
});
|
||||
await applyPolyfills();
|
||||
await defineCustomElements(window, {
|
||||
exclude: ['ion-tabs'],
|
||||
ce: (eventName: string, opts: any) => new CustomEvent(eventName.toLowerCase(), opts),
|
||||
ael,
|
||||
rel
|
||||
} as any);
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user