UNPKG

@slan-health/taro-vueuse

Version:

taro vue版本hooks

32 lines (31 loc) 666 B
import { watch, ref } from "vue"; import { definePlugin } from "../definePlugin.js"; const useReadyPlugin = definePlugin( (queryInstance, { ready = ref(true), manual, defaultParams = [] }) => { watch( ready, (val) => { if (!manual && val) { queryInstance.context.run(...defaultParams); } }, { flush: "sync" } ); return { onBefore() { if (!ready.value) { queryInstance.loading.value = false; return { isBreak: true }; } } }; } ); export { useReadyPlugin as default }; //# sourceMappingURL=useReadyPlugin.js.map