UNPKG

xdesign-vue-next

Version:

XDesign Component for vue-next

38 lines (34 loc) 938 B
/** * xdesign v1.0.6 * (c) 2023 xdesign * @license MIT */ import { _ as _slicedToArray } from '../_chunks/dep-32d4c595.mjs'; import { ref, watch } from 'vue'; import { getFileUrlByFileRaw } from '../_common/js/upload/utils.mjs'; import '../_chunks/dep-89b966f4.mjs'; import '../_common/js/log/log.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