azon_seeker/src/logic/common-setup.ts
2025-06-06 17:11:48 +08:00

22 lines
658 B
TypeScript

import type { App } from 'vue';
/**
* Setup Vue app
* @param app Vue app
*/
export function setupApp(app: App) {
const context = document.location.pathname.split('/')[2];
// Inject a globally available `$app` object in template
app.config.globalProperties.$app = {
context,
};
// Provide access to `app` in script setup with `const app = inject('app')`
app.provide('app', app.config.globalProperties.$app);
// Here you can install additional plugins for all contexts: popup, options page and content-script.
// example: app.use(i18n)
// example excluding content-script context: if (context !== 'content-script') app.use(i18n)
}