pixuireactcomponents 1.3.99 → 1.3.100

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.3.99",
3
+ "version": "1.3.100",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,2 +1,4 @@
1
1
  import { h } from 'preact';
2
- export declare const PreloadImg: (props: h.JSX.HTMLAttributes<HTMLDivElement>) => h.JSX.Element;
2
+ export declare const PreloadImg: (props: h.JSX.HTMLAttributes<HTMLDivElement> & h.JSX.HTMLAttributes<HTMLImageElement> & {
3
+ useImgTag: boolean;
4
+ }) => h.JSX.Element;
@@ -14,7 +14,7 @@ import { h } from 'preact';
14
14
  import { GameletAPI } from 'gamelet-pixui-frame';
15
15
  import { assetCache } from '../../../tools/assetCache';
16
16
  export var PreloadImg = function (props) {
17
- var src = props.src;
17
+ var src = props.src, useImgTag = props.useImgTag;
18
18
  var _a = useState(''), realSrc = _a[0], setRealSrc = _a[1];
19
19
  useEffect(function () {
20
20
  if (src) {
@@ -29,7 +29,7 @@ export var PreloadImg = function (props) {
29
29
  }
30
30
  }
31
31
  }, [src]);
32
- return (h("div", __assign({}, props, { style: __assign({ backgroundImage: "url(".concat(realSrc, ")"), backgroundSize: '100% 100%', backgroundRepeat: 'no-repeat' }, props.style) })));
32
+ return useImgTag ? (h("img", __assign({}, props, { src: realSrc }))) : (h("div", __assign({}, props, { style: __assign({ backgroundImage: "url(".concat(realSrc, ")"), backgroundSize: '100% 100%', backgroundRepeat: 'no-repeat' }, props.style) })));
33
33
  };
34
34
  var isJssdkEnv = function () {
35
35
  return GameletAPI.getRuntimeEnv() == 'jssdk-appwindow' || GameletAPI.getRuntimeEnv() == 'jssdk-preprocessor';