forked from fdzcxy212206413/gsl_grs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1019 B
44 lines
1019 B
import { watch, unref, nextTick } from 'vue';
|
|
|
|
const useDelayedRender = ({
|
|
indicator,
|
|
intermediateIndicator,
|
|
shouldSetIntermediate = () => true,
|
|
beforeShow,
|
|
afterShow,
|
|
afterHide,
|
|
beforeHide
|
|
}) => {
|
|
watch(() => unref(indicator), (val) => {
|
|
if (val) {
|
|
beforeShow == null ? void 0 : beforeShow();
|
|
nextTick(() => {
|
|
if (!unref(indicator))
|
|
return;
|
|
if (shouldSetIntermediate("show")) {
|
|
intermediateIndicator.value = true;
|
|
}
|
|
});
|
|
} else {
|
|
beforeHide == null ? void 0 : beforeHide();
|
|
nextTick(() => {
|
|
if (unref(indicator))
|
|
return;
|
|
if (shouldSetIntermediate("hide")) {
|
|
intermediateIndicator.value = false;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
watch(() => intermediateIndicator.value, (val) => {
|
|
if (val) {
|
|
afterShow == null ? void 0 : afterShow();
|
|
} else {
|
|
afterHide == null ? void 0 : afterHide();
|
|
}
|
|
});
|
|
};
|
|
|
|
export { useDelayedRender };
|
|
//# sourceMappingURL=index.mjs.map
|