@slan-health/taro-vueuse
Version:
taro vue版本hooks
17 lines (16 loc) • 474 B
JavaScript
import { ref, watch } from "vue";
import useThrottleFn from "../useThrottleFn/index.js";
function refThrottled(value, delay = 200, trailing = true, leading = true) {
if (delay <= 0)
return value;
const throttled = ref(value.value);
const updater = useThrottleFn(() => {
throttled.value = value.value;
}, delay, trailing, leading);
watch(value, () => updater());
return throttled;
}
export {
refThrottled as default
};
//# sourceMappingURL=index.js.map