traxxx-web/renderer/usePageContext.js

16 lines
396 B
JavaScript

// `usePageContext` allows us to access `pageContext` in any Vue component.
// See https://vike.dev/pageContext-anywhere
import { inject } from 'vue';
const key = Symbol(); // eslint-disable-line symbol-description
export function usePageContext() {
const pageContext = inject(key);
return pageContext;
}
export function setPageContext(app, pageContext) {
app.provide(key, pageContext);
}