utils.ts 435 Bytes
Newer Older
hucy's avatar
hucy committed
1 2 3 4 5 6 7 8 9 10 11 12 13
// 获取本地临时预览地址
export const getObjectURL = function (file: any) {
  let url = null as any;
  const _window = window as any;
  if (_window.createObjectURL != undefined) {
    url = _window.createObjectURL(file);
  } else if (_window.URL != undefined) {
    url = _window.URL.createObjectURL(file);
  } else if (_window.webkitURL != undefined) {
    url = _window.webkitURL.createObjectURL(file);
  }
  return url;
};