pb-sxp-ui 1.0.66 → 1.0.67
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.cjs +27 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -25
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +27 -25
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +1 -1
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/FormatImage.js +3 -20
- package/lib/core/components/SxpPageRender/FormatImage.js +3 -20
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -8382,7 +8382,7 @@
|
|
8382
8382
|
* @Author: binruan@chatlabs.com
|
8383
8383
|
* @Date: 2024-03-20 10:27:31
|
8384
8384
|
* @LastEditors: binruan@chatlabs.com
|
8385
|
-
* @LastEditTime: 2024-05-
|
8385
|
+
* @LastEditTime: 2024-05-20 15:53:04
|
8386
8386
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
|
8387
8387
|
*
|
8388
8388
|
*/
|
@@ -8394,32 +8394,34 @@
|
|
8394
8394
|
setImgSrc(v);
|
8395
8395
|
}
|
8396
8396
|
}));
|
8397
|
-
// useEffect(() => {
|
8398
|
-
// setImgSrc(src);
|
8399
|
-
// }, [src]);
|
8400
|
-
const imgRef = React.useRef(null);
|
8401
8397
|
React.useEffect(() => {
|
8402
|
-
|
8403
|
-
const { current } = imgRef;
|
8404
|
-
if (current) {
|
8405
|
-
observer = new IntersectionObserver((entries) => {
|
8406
|
-
entries.forEach((entry) => {
|
8407
|
-
if (entry.isIntersecting) {
|
8408
|
-
setImgSrc(src);
|
8409
|
-
observer.unobserve(current);
|
8410
|
-
}
|
8411
|
-
});
|
8412
|
-
}, { threshold: 0.1 } // 触发阈值,可根据需要调整
|
8413
|
-
);
|
8414
|
-
observer.observe(current);
|
8415
|
-
}
|
8416
|
-
return () => {
|
8417
|
-
if (observer && current) {
|
8418
|
-
observer.unobserve(current);
|
8419
|
-
}
|
8420
|
-
};
|
8398
|
+
setImgSrc(src);
|
8421
8399
|
}, [src]);
|
8422
|
-
|
8400
|
+
React.useRef(null);
|
8401
|
+
// useEffect(() => {
|
8402
|
+
// let observer: any = null;
|
8403
|
+
// const { current } = imgRef;
|
8404
|
+
// if (current) {
|
8405
|
+
// observer = new IntersectionObserver(
|
8406
|
+
// (entries) => {
|
8407
|
+
// entries.forEach((entry) => {
|
8408
|
+
// if (entry.isIntersecting) {
|
8409
|
+
// setImgSrc(src);
|
8410
|
+
// observer.unobserve(current);
|
8411
|
+
// }
|
8412
|
+
// });
|
8413
|
+
// },
|
8414
|
+
// { threshold: 0.1 } // 触发阈值,可根据需要调整
|
8415
|
+
// );
|
8416
|
+
// observer.observe(current);
|
8417
|
+
// }
|
8418
|
+
// return () => {
|
8419
|
+
// if (observer && current) {
|
8420
|
+
// observer.unobserve(current);
|
8421
|
+
// }
|
8422
|
+
// };
|
8423
|
+
// }, [src]);
|
8424
|
+
return (React.createElement(React.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
|
8423
8425
|
React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
|
8424
8426
|
React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
|
8425
8427
|
React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
|