@slan-health/taro-vueuse
Version:
taro vue版本hooks
17 lines (16 loc) • 481 B
JavaScript
import { inject, provide } from "vue";
function createInjectionState(composable) {
const key = Symbol("InjectionState");
const useProvidingState = (...args) => {
provide(key, composable(...args));
};
const install = (app, ...args) => {
app.provide(key, composable(...args));
};
const useInjectedState = () => inject(key);
return [useProvidingState, useInjectedState, install];
}
export {
createInjectionState as default
};
//# sourceMappingURL=index.js.map