@conecli/cone-render 0.8.15-beta.45 → 0.8.15-beta.47
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
1
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
3
2
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
4
3
|
const componentShowStateRef = useRef(false)
|
|
5
4
|
useEffect(() => {
|
|
6
5
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
7
6
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
8
7
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
9
8
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
10
9
|
})
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
<View
|
|
14
13
|
ref={componentLazyRef}
|
|
15
14
|
className={classNames(
|
|
16
15
|
imageStyle['d-app-lazy-image'],
|
|
17
16
|
{
|
|
18
17
|
[imageStyle['d-lazy-sku-image']]: isSkuImage,
|
|
19
18
|
},
|
|
20
19
|
{
|
|
21
20
|
[imageStyle['d-hide-image-error']]: imageErrState,
|
|
22
21
|
},
|
|
23
22
|
{
|
|
24
23
|
[imageStyle['d-load-completed']]: loadSuccess,
|
|
25
24
|
},
|
|
26
25
|
{
|
|
27
26
|
'd-imag-rendering-crisp-edges':
|
|
28
27
|
!taroJdBaseInfo.info.pageInfo.isVipShop &&
|
|
29
28
|
imagRenderingSet,
|
|
30
29
|
},
|
|
31
30
|
'J_html5ImageBg',
|
|
32
31
|
className,
|
|
33
32
|
)}
|
|
34
33
|
style={{
|
|
35
34
|
...style,
|
|
36
35
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
37
36
|
}}
|
|
38
37
|
>
|
|
39
38
|
{(componentShowState || lazyLoad === false) && <img
|
|
40
39
|
src={getQualityImage(
|
|
41
40
|
imgSrc,
|
|
42
41
|
taroJdBaseInfo.info.pageInfo.isVipShop
|
|
43
42
|
? NetWorkTypeQuality['perfect']
|
|
44
43
|
: NetWorkTypeQuality[getNetWorkType],
|
|
45
44
|
)}
|
|
46
45
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
47
46
|
onError={imageError}
|
|
48
47
|
/>}
|
|
49
48
|
</View>
|
|
50
49
|
) : (
|
|
51
50
|
<Image
|
|
52
51
|
style={{
|
|
53
52
|
...style,
|
|
54
53
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
55
54
|
}}
|
|
56
55
|
className={classNames(
|
|
57
56
|
imageStyle['d-lazy-image'],
|
|
58
57
|
{
|
|
59
58
|
[imageStyle['d-lazy-sku-image']]: isSkuImage,
|
|
60
59
|
},
|
|
61
60
|
{
|
|
62
61
|
[imageStyle['d-hide-image-error']]: imageErrState,
|
|
63
62
|
},
|
|
64
63
|
{
|
|
65
64
|
[imageStyle['d-load-completed']]: loadSuccess,
|
|
66
65
|
},
|
|
67
66
|
{
|
|
68
67
|
'd-imag-rendering-crisp-edges': imagRenderingSet,
|
|
69
68
|
},
|
|
70
69
|
className,
|
|
71
70
|
)}
|
|
72
71
|
src={getQualityImage(
|
|
73
72
|
imgSrc,
|
|
74
73
|
NetWorkTypeQuality[getNetWorkType],
|
|
75
74
|
)}
|
|
76
75
|
lazyLoad={lazyLoad}
|
|
77
76
|
onError={imageError}
|
|
78
77
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
79
78
|
{...otherOption}
|
|
80
79
|
/>
|
|
81
80
|
)
|
|
81
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
82
82
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
83
83
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
84
84
|
const componentShowStateRef = useRef(false)
|
|
85
85
|
useEffect(() => {
|
|
86
86
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
87
87
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
88
88
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
89
89
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
90
90
|
})
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
<View
|
|
94
94
|
ref={componentLazyRef}
|
|
95
95
|
className={classNames(
|
|
96
96
|
imageStyle['d-app-lazy-image'],
|
|
97
97
|
{
|
|
98
98
|
[imageStyle['d-lazy-sku-image']]: isSkuImage,
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
[imageStyle['d-hide-image-error']]: imageErrState,
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
[imageStyle['d-load-completed']]: loadSuccess,
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
'd-imag-rendering-crisp-edges':
|
|
108
108
|
!taroJdBaseInfo.info.pageInfo.isVipShop &&
|
|
109
109
|
imagRenderingSet,
|
|
110
110
|
},
|
|
111
111
|
'J_html5ImageBg',
|
|
112
112
|
className,
|
|
113
113
|
)}
|
|
114
114
|
style={{
|
|
115
115
|
...style,
|
|
116
116
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
117
117
|
}}
|
|
118
118
|
>
|
|
119
119
|
{componentShowState && <img
|
|
120
120
|
src={getQualityImage(
|
|
121
121
|
imgSrc,
|
|
122
122
|
taroJdBaseInfo.info.pageInfo.isVipShop
|
|
123
123
|
? NetWorkTypeQuality['perfect']
|
|
124
124
|
: NetWorkTypeQuality[getNetWorkType],
|
|
125
125
|
)}
|
|
126
126
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
127
127
|
onError={imageError}
|
|
128
128
|
/>}
|
|
129
129
|
</View>
|
|
130
130
|
) : (
|
|
131
131
|
<Image
|
|
132
132
|
style={{
|
|
133
133
|
...style,
|
|
134
134
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
135
135
|
}}
|
|
136
136
|
className={classNames(
|
|
137
137
|
imageStyle['d-lazy-image'],
|
|
138
138
|
{
|
|
139
139
|
[imageStyle['d-lazy-sku-image']]: isSkuImage,
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
[imageStyle['d-hide-image-error']]: imageErrState,
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
145
|
[imageStyle['d-load-completed']]: loadSuccess,
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
'd-imag-rendering-crisp-edges': imagRenderingSet,
|
|
149
149
|
},
|
|
150
150
|
className,
|
|
151
151
|
)}
|
|
152
152
|
src={getQualityImage(
|
|
153
153
|
imgSrc,
|
|
154
154
|
NetWorkTypeQuality[getNetWorkType],
|
|
155
155
|
)}
|
|
156
156
|
lazyLoad={lazyLoad}
|
|
157
157
|
onError={imageError}
|
|
158
158
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
159
159
|
{...otherOption}
|
|
160
160
|
/>
|
|
161
161
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { Suspense, lazy } from 'react'
|
|
2
1
|
console.log('>>>>>>>>>> floorModuleType === FloorModuleType.ISVDESIGNERH5MODULE >>>>>>>>>>')
|
|
3
2
|
try {
|
|
4
3
|
console.log('>>>>>>>>>> 开始渲染1个isv模块 >>>>>>>>>>')
|
|
5
4
|
console.log('==========当前业务类型renderSourceType、楼层floorId: ', renderSourceType, floorData.uid)
|
|
6
5
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
7
6
|
const modularPackResultObj = typeof modularPackResult === 'string' ? JSON.parse(modularPackResult) : modularPackResult
|
|
8
7
|
|
|
9
8
|
if (modularPackResultObj) {
|
|
10
9
|
const { bundleUrl, bundleFileName } = modularPackResultObj
|
|
11
10
|
if (bundleUrl && bundleFileName) {
|
|
12
11
|
let ISVModule = taroJdBaseInfo?.renderedIsvComponents[`${floorData.uid}_${bundleFileName}`] || null
|
|
13
12
|
if (!ISVModule) {
|
|
14
13
|
ISVModule = lazy(() => import(bundleFileName + '@@@@@@' + bundleUrl))
|
|
15
14
|
console.log('1|加载isv模块==========走lazy import生成新的isv模块react组件', bundleFileName)
|
|
16
15
|
taroJdBaseInfo.renderedIsvComponents[`${floorData.uid}_${bundleFileName}`] = ISVModule
|
|
17
16
|
console.log('2|渲染isv模块的react组件==========,window.taroJshopH5WebpackJsonp上的组件是否已就绪: ', bundleFileName, window['taroJshopH5WebpackJsonp'].find(item => item[0][0] == bundleFileName))
|
|
18
17
|
} else {
|
|
19
18
|
console.log('1|加载isv模块==========不走lazy import生成新的isv模块react组件,从已加载中获取,taroJdBaseInfo: ', taroJdBaseInfo)
|
|
20
19
|
console.log('2|渲染isv模块的react组件==========,taroJdBaseInfo.renderedIsvComponents上的组件是否已就绪: ', taroJdBaseInfo.renderedIsvComponents[`${floorData.uid}_${bundleFileName}`])
|
|
21
20
|
}
|
|
22
21
|
const _floorHeight = getFloorSetHeight(floorData)
|
|
23
22
|
|
|
24
23
|
return (
|
|
25
24
|
<ErrorBoundary {...props}>
|
|
26
25
|
<Suspense fallback={<View style={{
|
|
27
26
|
position: 'relative',
|
|
28
27
|
background: `#ffffff url('${JD_PLACEHOLDER_IMG}') center center no-repeat`,
|
|
29
28
|
height: `${_floorHeight}px`,
|
|
30
29
|
}}></View>}>
|
|
31
30
|
<ISVFloor {...props} dataDefines={dataDefines}>
|
|
32
31
|
<ISVModule {...props} dataDefines={dataDefines}></ISVModule>
|
|
33
32
|
</ISVFloor>
|
|
34
33
|
</Suspense>
|
|
35
34
|
</ErrorBoundary >
|
|
36
35
|
)
|
|
37
36
|
} else {
|
|
38
37
|
console.log('3|isv模块渲染异常,modularPackResult中缺少bundleUrl或bundleFileName==========modularPackResult: ', modularPackResultObj)
|
|
39
38
|
console.log('==========bundleUrl: ', bundleUrl)
|
|
40
39
|
console.log('==========bundleFileName: ', bundleFileName)
|
|
41
40
|
return null
|
|
42
41
|
}
|
|
43
42
|
} else {
|
|
44
43
|
console.log('3|isv模块渲染异常,缺少modularPackResult==========modularPackResult: ', modularPackResultObj)
|
|
45
44
|
return null
|
|
46
45
|
}
|
|
47
46
|
} catch (err) {
|
|
48
47
|
console.log('3|isv模块渲染异常,floorItem逻辑错误==========err: ', err)
|
|
49
48
|
DraException.JSAgent.reportException(err)
|
|
50
49
|
return null
|
|
51
50
|
}
|
|
52
51
|
})()
|
|
53
52
|
if(renderResult === null){
|
|
54
53
|
console.log('renderResult === null: 命中了!')
|
|
55
54
|
taroEventSendPageScrollInfo()
|
|
56
55
|
}else{
|
|
57
56
|
console.log('renderResult !== null: 没命中', renderResult)
|
|
58
57
|
}
|
|
59
58
|
return renderResult
|
|
59
|
+
import React, { Suspense, lazy } from 'react'
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function webpackUniversalModuleDefinition(root, factory) {
|