baixingwenzheng-pc/node_modules/vooks/lib/use-false-until-truthy.js
2024-01-29 09:26:07 +08:00

17 lines
526 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vue_1 = require("vue");
function useFalseUntilTruthy(originalRef) {
const currentRef = (0, vue_1.ref)(!!originalRef.value);
if (currentRef.value)
return (0, vue_1.readonly)(currentRef);
const stop = (0, vue_1.watch)(originalRef, (value) => {
if (value) {
currentRef.value = true;
stop();
}
});
return (0, vue_1.readonly)(currentRef);
}
exports.default = useFalseUntilTruthy;