@gm-mobile/mp 3.12.12-beta.1 → 3.12.13

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.
Files changed (2) hide show
  1. package/README.md +118 -0
  2. package/package.json +5 -5
package/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # @gm-mobile/mp
2
+
3
+ ## 简介
4
+ 小程序适配包 - 基于 Taro.js 的微信小程序组件和工具库,提供小程序端的页面组件、存储、路由、上传等功能。
5
+
6
+ ## 安装
7
+
8
+ ```bash
9
+ npm install @gm-mobile/mp
10
+ ```
11
+
12
+ ### peerDependencies
13
+
14
+ ```json
15
+ {
16
+ "@tarojs/components": "3.0.18",
17
+ "classnames": "^2.2.6",
18
+ "lodash": "^4.17.15",
19
+ "moment": "^2.26.0",
20
+ "prop-types": "^15.7.2",
21
+ "react": "^16.13.1"
22
+ }
23
+ ```
24
+
25
+ ## 使用
26
+
27
+ ### 快速开始
28
+
29
+ ```jsx
30
+ import { PageMP, Router, LocalStorage } from '@gm-mobile/mp'
31
+ ```
32
+
33
+ ## API
34
+
35
+ ### 导出列表
36
+
37
+ #### 工具类
38
+
39
+ | 导出项 | 类型 | 说明 |
40
+ |--------|------|------|
41
+ | `LocalStorage` | 类 | 本地存储封装 |
42
+ | `useFirstDidShow` | Hook | 首次 `didShow` 生命周期钩子 |
43
+ | `Router` | 类 | 路由工具 |
44
+ | `upload` | 函数 | 文件上传工具 |
45
+
46
+ #### 小程序组件
47
+
48
+ | 导出项 | 类型 | 说明 |
49
+ |--------|------|------|
50
+ | `Image` | 组件 | 小程序图片组件 |
51
+ | `PageMP` | 组件 | 小程序页面容器组件 |
52
+ | `Counter` | 组件 | 小程序计数器组件 |
53
+ | `StatusBar` | 组件 | 状态栏组件 |
54
+ | `Swiper` | 组件 | 轮播组件 |
55
+ | `SafeHeader` | 组件 | 安全区域头部组件 |
56
+ | `SafeBottom` | 组件 | 安全区域底部组件 |
57
+
58
+ #### 基础组件(从 @gm-mobile/c-react 重新导出)
59
+
60
+ 同时导出 `@gm-mobile/c-react` 的所有组件,包括 Button、Flex、Dialog、Toast 等。
61
+
62
+ ## 示例
63
+
64
+ ### 小程序页面
65
+
66
+ ```jsx
67
+ import { PageMP, SafeHeader, SafeBottom } from '@gm-mobile/mp'
68
+
69
+ const App = () => {
70
+ return (
71
+ <PageMP>
72
+ <SafeHeader />
73
+ <div>页面内容</div>
74
+ <SafeBottom />
75
+ </PageMP>
76
+ )
77
+ }
78
+ ```
79
+
80
+ ### 本地存储
81
+
82
+ ```jsx
83
+ import { LocalStorage } from '@gm-mobile/mp'
84
+
85
+ // 设置值
86
+ LocalStorage.set('key', 'value')
87
+
88
+ // 获取值
89
+ const value = LocalStorage.get('key')
90
+
91
+ // 移除值
92
+ LocalStorage.remove('key')
93
+ ```
94
+
95
+ ### 首次显示钩子
96
+
97
+ ```jsx
98
+ import { useFirstDidShow } from '@gm-mobile/mp'
99
+
100
+ const App = () => {
101
+ useFirstDidShow(() => {
102
+ console.log('页面首次显示')
103
+ })
104
+
105
+ return <div>内容</div>
106
+ }
107
+ ```
108
+
109
+ ## 注意事项
110
+ - 该包基于 Taro.js 3.0.18,需配合 Taro 项目使用
111
+ - 不提供 `LayoutRoot` 和 `Page`(Web 端组件),请使用 `PageMP` 代替
112
+ - 同时导出 `@gm-mobile/c-react` 的所有组件,可直接从本包导入
113
+ - 依赖 `dayjs` 进行日期处理
114
+
115
+ ## 相关包
116
+ - [@gm-mobile/c-react](../c-react) - 基础 React 组件
117
+ - [@gm-mobile/react](../react) - Web 端主组件库
118
+ - [@gm-mobile/locales](../locales) - 国际化工具
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gm-mobile/mp",
3
- "version": "3.12.12-beta.1",
3
+ "version": "3.12.13",
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.12.12-beta.1",
25
- "@gm-mobile/c-tool": "^3.12.12-beta.1",
26
- "@gm-mobile/locales": "^3.12.12-beta.1",
24
+ "@gm-mobile/c-react": "^3.12.13",
25
+ "@gm-mobile/c-tool": "^3.12.13",
26
+ "@gm-mobile/locales": "^3.12.13",
27
27
  "dayjs": "^1.11.6"
28
28
  },
29
29
  "peerDependencies": {
@@ -34,5 +34,5 @@
34
34
  "prop-types": "^15.7.2",
35
35
  "react": "^16.13.1"
36
36
  },
37
- "gitHead": "8241f847ca2e7cfbbb67076d8d89f00e20c3977b"
37
+ "gitHead": "f1807b01b33bb8ee331b6c713d52d85fda524bf7"
38
38
  }