tdesign-vue-next
Version:
TDesign Component for vue-next
37 lines (33 loc) • 902 B
JavaScript
/**
* tdesign v1.11.5
* (c) 2025 tdesign
* @license MIT
*/
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import { ref, watch } from 'vue';
import { g as getFileUrlByFileRaw } from '../_chunks/dep-b6747d4a.js';
import '../_chunks/dep-92106726.js';
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.js.map