tdesign-vue-next
Version:
TDesign Component for vue-next
38 lines (34 loc) • 943 B
JavaScript
/**
* tdesign v1.11.5
* (c) 2025 tdesign
* @license MIT
*/
import { _ as _slicedToArray } from '../_chunks/dep-6d9c1bfc.mjs';
import { ref, watch } from 'vue';
import { g as getFileUrlByFileRaw } from '../_chunks/dep-dda40c90.mjs';
import '../_chunks/dep-9f375e51.mjs';
import '../_chunks/dep-88187fb2.mjs';
function useImagePreviewUrl(imgUrl) {
var previewUrl = ref("");
watch([imgUrl], function (_ref, _ref2) {
var _ref3 = _slicedToArray(_ref, 1),
imgUrl2 = _ref3[0];
var _ref4 = _slicedToArray(_ref2, 1),
preImgUrl = _ref4[0];
if (preImgUrl === imgUrl2) return;
if (typeof imgUrl2 === "string") {
previewUrl.value = imgUrl2;
return;
}
getFileUrlByFileRaw(imgUrl2).then(function (url) {
previewUrl.value = url;
});
}, {
immediate: true
});
return {
previewUrl: previewUrl
};
}
export { useImagePreviewUrl };
//# sourceMappingURL=useImagePreviewUrl.mjs.map