import { BlLifeRecharge } from './lifeRecharge';
|
import { inject, shallowReactive } from 'vue';
|
import type { InjectionKey, UnwrapNestedRefs, Ref } from 'vue';
|
|
export type LifeRechargeContext = {
|
blLifeRecharge: UnwrapNestedRefs<BlLifeRecharge>;
|
};
|
|
const clientKey: InjectionKey<LifeRechargeContext> = Symbol('blLifeRecharge');
|
|
export type VueLifeRechargePluginOptions = {
|
blLifeRecharge: BlLifeRecharge;
|
};
|
|
export const VueLifeRechargePlugin = {
|
install: (app: any, { blLifeRecharge }: VueLifeRechargePluginOptions) => {
|
app.provide(clientKey, {
|
blLifeRecharge: shallowReactive(blLifeRecharge),
|
});
|
},
|
};
|
|
export function useLifeRechargeContext() {
|
return inject(clientKey);
|
}
|