UNPKG

@cran/vue.use

Version:

Cranberry Vue Use Utilities

14 lines (13 loc) 430 B
import { ref, unref, watch } from "@vue/runtime-dom"; export function useProgress(...refs) { const container = ref(0); const weight = 1 / refs.length; watch(refs, function onNext(values) { let total = 0; for (const value of values) { total += Math.min(1, Math.max(0, +unref(value))) * weight; } container.value = total; }, { immediate: true, }); return container; }