UNPKG

keep-vue

Version:

Keep Vue is an open-source component library built on top of Vue3 and Tailwind CSS. It offers a collection of pre-designed UI components and styles that you can easily integrate into your web applications.

20 lines (19 loc) 650 B
import { ref } from "vue"; import { createInjectionState } from "@vueuse/core"; // custom injectionKey const PaginationStoreKey = "pagination-store"; const [useProvidePagination, usePaginationStore] = createInjectionState((initialValue) => { //state const shape = ref(initialValue); return { shape }; }, { injectionKey: PaginationStoreKey, }); function usePagination() { const paginationStore = usePaginationStore(); if (paginationStore == null) { throw new Error("Please call `useProvidePagination` on the <Pagination/> component"); } return paginationStore; } export { usePagination, useProvidePagination };