committed by
GitHub
parent
3bd1f99d28
commit
1f088d2208
30
packages/sdks/nuxt/src/runtime/plugin.client.ts
Normal file
30
packages/sdks/nuxt/src/runtime/plugin.client.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { OpenPanel } from '@openpanel/web';
|
||||
import { defineNuxtPlugin, useRuntimeConfig } from '#app';
|
||||
import type { ModuleOptions } from '../types';
|
||||
|
||||
declare module '#app' {
|
||||
interface NuxtApp {
|
||||
$openpanel: OpenPanel;
|
||||
}
|
||||
}
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
interface ComponentCustomProperties {
|
||||
$openpanel: OpenPanel;
|
||||
}
|
||||
}
|
||||
|
||||
export default defineNuxtPlugin({
|
||||
name: 'openpanel',
|
||||
parallel: true,
|
||||
setup() {
|
||||
const config = useRuntimeConfig().public.openpanel as ModuleOptions;
|
||||
const op = new OpenPanel(config);
|
||||
|
||||
return {
|
||||
provide: {
|
||||
openpanel: op,
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user