@tarojs/taro-h5 3.5.0 → 3.5.1-aplha.0

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
@@ -1022,7 +1022,7 @@ const canvasToTempFilePath = ({ canvasId, fileType, quality, success, fail, comp
1022
1022
  const el = findDOM(inst);
1023
1023
  const canvas = el === null || el === void 0 ? void 0 : el.querySelector(`canvas[canvas-id="${canvasId}"]`);
1024
1024
  try {
1025
- const dataURL = canvas === null || canvas === void 0 ? void 0 : canvas.toDataURL(`image/${fileType || 'png'}`, quality);
1025
+ const dataURL = canvas === null || canvas === void 0 ? void 0 : canvas.toDataURL(`image/${(fileType === 'jpg' ? 'jpeg' : fileType) || 'png'}`, quality);
1026
1026
  return handle.success({
1027
1027
  tempFilePath: dataURL
1028
1028
  });
@@ -4510,7 +4510,7 @@ const FRAME_DURATION = 17;
4510
4510
  /**
4511
4511
  * 将页面滚动到目标位置
4512
4512
  */
4513
- const pageScrollTo = ({ scrollTop, selector = '', duration = 300, success, fail, complete }) => {
4513
+ const pageScrollTo = ({ scrollTop, selector = '', offsetTop = 0, duration = 300, success, fail, complete }) => {
4514
4514
  let scrollFunc;
4515
4515
  const handle = new MethodHandler({ name: 'pageScrollTo', success, fail, complete });
4516
4516
  return new Promise((resolve, reject) => {
@@ -4553,12 +4553,12 @@ const pageScrollTo = ({ scrollTop, selector = '', duration = 300, success, fail,
4553
4553
  }
4554
4554
  const from = scrollFunc();
4555
4555
  let to;
4556
- if (typeof scrollTop === 'number') {
4557
- to = scrollTop;
4556
+ if (selector) {
4557
+ const el = document.querySelector(selector);
4558
+ to = ((el === null || el === void 0 ? void 0 : el.offsetTop) || 0) + offsetTop;
4558
4559
  }
4559
4560
  else {
4560
- const el = document.querySelector(selector);
4561
- to = (el === null || el === void 0 ? void 0 : el.offsetTop) || 0;
4561
+ to = typeof scrollTop === 'number' ? scrollTop : 0;
4562
4562
  }
4563
4563
  const delta = to - from;
4564
4564
  const frameCnt = duration / FRAME_DURATION;