@tarojs/taro-h5 3.5.7-alpha.9 → 3.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2327,6 +2327,7 @@ const previewImage = (options) => __awaiter(void 0, void 0, void 0, function* ()
2327
2327
  image.style.maxWidth = '100%';
2328
2328
  image.src = url;
2329
2329
  const div = document.createElement('div');
2330
+ div.classList.add('swiper-zoom-container');
2330
2331
  div.style.cssText = 'display:flex;align-items:center;justify-content:center;max-width:100%;min-height:100%;';
2331
2332
  div.appendChild(image);
2332
2333
  item.appendChild(div);
@@ -2357,6 +2358,8 @@ const previewImage = (options) => __awaiter(void 0, void 0, void 0, function* ()
2357
2358
  const swiper = document.createElement('taro-swiper-core');
2358
2359
  // @ts-ignore
2359
2360
  swiper.full = true;
2361
+ // @ts-ignore
2362
+ swiper.zoom = true;
2360
2363
  let children = [];
2361
2364
  try {
2362
2365
  children = yield Promise.all(urls.map(e => loadImage(e, fail)));
@@ -2652,8 +2655,8 @@ const convertObjectUrlToBlob = url => {
2652
2655
  });
2653
2656
  };
2654
2657
 
2655
- const createDownloadTask = ({ url, header, withCredentials = true, success, error }) => {
2656
- let timeout;
2658
+ const createDownloadTask = ({ url, header, withCredentials = true, timeout, success, error }) => {
2659
+ let timeoutInter;
2657
2660
  const apiName = 'downloadFile';
2658
2661
  const xhr = new XMLHttpRequest();
2659
2662
  const callbackManager = {
@@ -2689,7 +2692,7 @@ const createDownloadTask = ({ url, header, withCredentials = true, success, erro
2689
2692
  });
2690
2693
  };
2691
2694
  xhr.onabort = () => {
2692
- clearTimeout(timeout);
2695
+ clearTimeout(timeoutInter);
2693
2696
  error({
2694
2697
  errMsg: `${apiName}:fail abort`
2695
2698
  });
@@ -2707,7 +2710,7 @@ const createDownloadTask = ({ url, header, withCredentials = true, success, erro
2707
2710
  };
2708
2711
  const send = () => {
2709
2712
  xhr.send();
2710
- timeout = setTimeout(() => {
2713
+ timeoutInter = setTimeout(() => {
2711
2714
  xhr.onabort = null;
2712
2715
  xhr.onload = null;
2713
2716
  xhr.onprogress = null;
@@ -2717,7 +2720,7 @@ const createDownloadTask = ({ url, header, withCredentials = true, success, erro
2717
2720
  error({
2718
2721
  errMsg: `${apiName}:fail timeout`
2719
2722
  });
2720
- }, NETWORK_TIMEOUT);
2723
+ }, timeout || NETWORK_TIMEOUT);
2721
2724
  };
2722
2725
  send();
2723
2726
  /**
@@ -2752,13 +2755,14 @@ const createDownloadTask = ({ url, header, withCredentials = true, success, erro
2752
2755
  * 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径。使用前请注意阅读相关说明。
2753
2756
  * 注意:请在服务端响应的 header 中指定合理的 Content-Type 字段,以保证客户端正确处理文件类型。
2754
2757
  */
2755
- const downloadFile = ({ url, header, withCredentials, success, fail, complete }) => {
2758
+ const downloadFile = ({ url, header, withCredentials, timeout, success, fail, complete }) => {
2756
2759
  let task;
2757
2760
  const result = new Promise((resolve, reject) => {
2758
2761
  task = createDownloadTask({
2759
2762
  url,
2760
2763
  header,
2761
2764
  withCredentials,
2765
+ timeout,
2762
2766
  success: res => {
2763
2767
  success && success(res);
2764
2768
  complete && complete(res);