@conecli/cone-render 0.8.15-beta.2 → 0.8.15-beta.21
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/README.md +0 -2
- package/dist/common/const.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/components/ErrorBoundary.tsx +1 -0
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/floorItem.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/open/index.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/utils.ts +1 -1
- package/package.json +6 -6
- package/dist/components/ErrorBoundary.jsx +0 -42
package/README.md
CHANGED
package/dist/common/const.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import { isPublishToWxapp } from '../config/env'
|
|
1
|
+
import { isPublishToWxapp } from '../config/env'
|
package/dist/common/index.h5.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from 'react'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro, { useRouter } from '@tarojs/taro'
|
|
1
|
+
import Taro, { useRouter } from '@tarojs/taro'
|
|
2
2
|
floorData = {},
|
|
3
3
|
const rootDom = document.querySelector('#J_shopHomeRoot')
|
|
4
4
|
root: rootDom,
|
|
5
5
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
6
6
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
7
7
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
if(componentShowState === true){
|
|
10
10
|
console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
|
|
11
11
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
12
12
|
console.log('>>>>>>>>>>>>>>>>>>> 向IOS原生发送通知请求ISV模块依赖JS文件:', bundleUrl)
|
|
13
13
|
nativePageRegisterMessage(
|
|
14
14
|
Message_Type.NATIVE_INJECT_JS_FILE,
|
|
15
15
|
{
|
|
16
16
|
data: {
|
|
17
17
|
"bundleUrl": [bundleUrl]
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
)
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}, [componentShowState])
|
|
24
24
|
ref={ref}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, {useCallback, useState} from 'react'
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
2
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
3
3
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
4
4
|
const componentShowStateRef = useRef(false)
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
7
7
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
8
8
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
9
9
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
10
10
|
})
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
<View
|
|
14
14
|
ref={componentLazyRef}
|
|
15
15
|
className={classNames(
|
|
16
16
|
imageStyle['d-app-lazy-image'],
|
|
17
17
|
{
|
|
18
18
|
[imageStyle['d-lazy-sku-image']]: isSkuImage,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
[imageStyle['d-hide-image-error']]: imageErrState,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
[imageStyle['d-load-completed']]: loadSuccess,
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
'd-imag-rendering-crisp-edges':
|
|
28
28
|
!taroJdBaseInfo.info.pageInfo.isVipShop &&
|
|
29
29
|
imagRenderingSet,
|
|
30
30
|
},
|
|
31
31
|
'J_html5ImageBg',
|
|
32
32
|
className,
|
|
33
33
|
)}
|
|
34
34
|
style={{
|
|
35
35
|
...style,
|
|
36
36
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
37
37
|
}}
|
|
38
38
|
>
|
|
39
39
|
{componentShowState && <img
|
|
40
40
|
src={getQualityImage(
|
|
41
41
|
imgSrc,
|
|
42
42
|
taroJdBaseInfo.info.pageInfo.isVipShop
|
|
43
43
|
? NetWorkTypeQuality['perfect']
|
|
44
44
|
: NetWorkTypeQuality[getNetWorkType],
|
|
45
45
|
)}
|
|
46
46
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
47
47
|
onError={imageError}
|
|
48
48
|
/>}
|
|
49
49
|
</View>
|
|
50
50
|
) : (
|
|
51
51
|
<Image
|
|
52
52
|
style={{
|
|
53
53
|
...style,
|
|
54
54
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
55
55
|
}}
|
|
56
56
|
className={classNames(
|
|
57
57
|
imageStyle['d-lazy-image'],
|
|
58
58
|
{
|
|
59
59
|
[imageStyle['d-lazy-sku-image']]: isSkuImage,
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
[imageStyle['d-hide-image-error']]: imageErrState,
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
[imageStyle['d-load-completed']]: loadSuccess,
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
'd-imag-rendering-crisp-edges': imagRenderingSet,
|
|
69
69
|
},
|
|
70
70
|
className,
|
|
71
71
|
)}
|
|
72
72
|
src={getQualityImage(
|
|
73
73
|
imgSrc,
|
|
74
74
|
NetWorkTypeQuality[getNetWorkType],
|
|
75
75
|
)}
|
|
76
76
|
lazyLoad={lazyLoad}
|
|
77
77
|
onError={imageError}
|
|
78
78
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
79
79
|
{...otherOption}
|
|
80
80
|
/>
|
|
81
81
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { Suspense, lazy } from 'react'
|
|
1
|
+
import React, { Suspense, lazy } from 'react'
|
package/dist/interface/common.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react'
|
|
2
2
|
floorData={floorItem}
|
package/dist/open/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
2
2
|
console.log('>>>>>>>>>>>>>>>>>>> taroEventSendPageScrollInfo res:', options)
|
|
3
3
|
if(isJdApp && isH5AndJdShopView && isAndroidDevice){
|
|
4
4
|
setTimeout(() => {
|
|
5
5
|
nativePageRegisterMessage(
|
|
6
6
|
Message_Type.NATIVE_GET_SCROLL_TOP,
|
|
7
7
|
null,
|
|
8
8
|
)
|
|
9
9
|
}, 0)
|
|
10
10
|
}
|
package/dist/utils/utils.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conecli/cone-render",
|
|
3
|
-
"version": "0.8.15-beta.
|
|
3
|
+
"version": "0.8.15-beta.21",
|
|
4
4
|
"private": false,
|
|
5
|
-
"main": "dist/open/index.ts",
|
|
6
5
|
"files": [
|
|
7
6
|
"dist/"
|
|
8
7
|
],
|
|
9
8
|
"exports": {
|
|
10
|
-
".": "./dist/open/index.ts",
|
|
11
9
|
"./api": "./dist/open/api/index.ts",
|
|
12
10
|
"./components": "./dist/open/components/index.ts",
|
|
13
|
-
"./modules": "./dist/open/modules/index.ts"
|
|
11
|
+
"./modules": "./dist/open/modules/index.ts",
|
|
12
|
+
"./_utils/": "./dist/utils/"
|
|
14
13
|
},
|
|
15
14
|
"description": "cone-render",
|
|
16
15
|
"templateInfo": {
|
|
@@ -52,6 +51,7 @@
|
|
|
52
51
|
],
|
|
53
52
|
"author": "conecli",
|
|
54
53
|
"dependencies": {
|
|
54
|
+
"@jmfe/jd-jssdk": "^3.3.1-alpha.0",
|
|
55
55
|
"@tarojs/cli": "^3.5.4",
|
|
56
56
|
"@tarojs/components": "3.5.4",
|
|
57
57
|
"@tarojs/plugin-framework-react": "3.5.4",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"react": "^18.2.0",
|
|
69
69
|
"react-content-loader": "^6.2.0",
|
|
70
70
|
"react-dom": "^18.2.0",
|
|
71
|
-
"react-
|
|
72
|
-
"react-
|
|
71
|
+
"react-intersection-observer": "^9.1.0",
|
|
72
|
+
"react-refresh": "^0.14.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@babel/core": "^7.8.0",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: lichang68
|
|
3
|
-
* @Date: 2022-10-31 20:27:51
|
|
4
|
-
* @LastEditTime: 2022-11-01 10:54:17
|
|
5
|
-
* @LastEditors: lichang68
|
|
6
|
-
* @Description: 错误边界,是一个React组件,只能是class组件,可以捕获发生在子组件树任何位置的js错误,并打印这些错误,同时展示降级UI,并不会渲染发生崩溃的子组件树。
|
|
7
|
-
* 包裹ContainerFloorList,捕获isv h5楼层渲染时的错误异常,并做屏蔽处理
|
|
8
|
-
* @FilePath: /shop-react/Users/cdlichang1/Documents/work/workSpace/cone-render/src/components/ErrorBoundary.jsx
|
|
9
|
-
*/
|
|
10
|
-
import React from 'react'
|
|
11
|
-
import { Text } from '@tarojs/components'
|
|
12
|
-
export default class ErrorBoundary extends React.Component {
|
|
13
|
-
constructor(props) {
|
|
14
|
-
super(props);
|
|
15
|
-
this.state = {
|
|
16
|
-
hasError: false,
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static getDerivedStateFromError(error) {
|
|
21
|
-
// 更新 state 使下一次渲染能够显示出错降级后的 UI
|
|
22
|
-
return {
|
|
23
|
-
hasError: true
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
componentDidCatch(error, errorInfo) {
|
|
28
|
-
// 打印错误信息,error错误信息,errorInfo错误堆栈
|
|
29
|
-
console.log('isv模块渲染异常ErrorBoundary==========error: ', error.toString())
|
|
30
|
-
console.log('isv模块渲染异常ErrorBoundary==========errorInfo: ', errorInfo.componentStack)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
render() {
|
|
34
|
-
if (this.state.hasError) {
|
|
35
|
-
// 可以在这里自定义出错降级后的 UI 并渲染
|
|
36
|
-
// 对于isv模块,出错后隐藏楼层
|
|
37
|
-
return null
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return this.props.children
|
|
41
|
-
}
|
|
42
|
-
}
|