@gm-mobile/mp 3.9.3 → 3.9.4-alpha.2
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 +5 -5
- package/src/component/page/page.tsx +16 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-mobile/mp",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.4-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
|
6
6
|
"homepage": "https://github.com/gmfe/gm-mobile#readme",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"url": "https://github.com/gmfe/gm-mobile/issues"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@gm-mobile/c-react": "^3.9.
|
|
25
|
-
"@gm-mobile/c-tool": "^3.9.
|
|
26
|
-
"@gm-mobile/locales": "^3.9.
|
|
24
|
+
"@gm-mobile/c-react": "^3.9.4-alpha.2",
|
|
25
|
+
"@gm-mobile/c-tool": "^3.9.4-alpha.2",
|
|
26
|
+
"@gm-mobile/locales": "^3.9.4-alpha.2"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@tarojs/components": "3.0.18",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"prop-types": "^15.7.2",
|
|
34
34
|
"react": "^16.13.1"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "cbed3b0f5f17996f4fa6ab7c5e0ed3a75dfbf2f9"
|
|
37
37
|
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useEffect,
|
|
3
|
-
useRef,
|
|
4
|
-
FC,
|
|
5
|
-
useState,
|
|
6
|
-
ReactNode,
|
|
7
|
-
CSSProperties,
|
|
8
|
-
} from 'react'
|
|
1
|
+
import React, { useEffect, useRef, FC, useState, CSSProperties } from 'react'
|
|
9
2
|
import { Flex, LayoutRoot, LayoutRootV1, Loading } from '@gm-mobile/c-react'
|
|
10
3
|
import { ScrollView, View } from '@tarojs/components'
|
|
11
4
|
import PageBase, { PageProps } from './base'
|
|
12
5
|
import { pxTransform } from '@tarojs/taro'
|
|
13
6
|
|
|
14
7
|
interface PageMPProps extends PageProps {
|
|
15
|
-
/**
|
|
8
|
+
/** 最大宽度,对超过最大宽度的页面做做居中变窄处理 */
|
|
16
9
|
maxWidth?: number
|
|
17
10
|
onRefresh?: () => Promise<any>
|
|
18
11
|
/** 上滑加载更多事件。如果promise返回一个空数组,表示没有更多了 */
|
|
@@ -21,7 +14,7 @@ interface PageMPProps extends PageProps {
|
|
|
21
14
|
|
|
22
15
|
const PageMP: FC<PageMPProps> = ({
|
|
23
16
|
children,
|
|
24
|
-
maxWidth =
|
|
17
|
+
maxWidth = 2048,
|
|
25
18
|
onRefresh,
|
|
26
19
|
onLoadMore,
|
|
27
20
|
style,
|
|
@@ -158,3 +151,16 @@ const PageMP: FC<PageMPProps> = ({
|
|
|
158
151
|
|
|
159
152
|
export default PageMP
|
|
160
153
|
export type { PageMPProps }
|
|
154
|
+
|
|
155
|
+
/** 适配后的高度,考虑ipad 大屏裁剪宽度后的比例 */
|
|
156
|
+
export function calcPageHeightWithMaxWidth(maxWidth = 480) {
|
|
157
|
+
const { screenWidth } = wx.getSystemInfoSync()
|
|
158
|
+
const transformRatio = maxWidth / screenWidth
|
|
159
|
+
return `calc(100vh / ${transformRatio})`
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function calcPageWidthWithMaxWidth(maxWidth = 800) {
|
|
163
|
+
const { screenWidth } = wx.getSystemInfoSync()
|
|
164
|
+
const transformRatio = maxWidth / screenWidth
|
|
165
|
+
return `calc(100vw / ${transformRatio})`
|
|
166
|
+
}
|