@zfqh/uniapp 0.1.1

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 (310) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +39 -0
  4. package/docs/api/apis/core.md +189 -0
  5. package/docs/api/apis/index.md +82 -0
  6. package/docs/api/apis/request.md +369 -0
  7. package/docs/api/configs/api.md +32 -0
  8. package/docs/api/configs/app.md +43 -0
  9. package/docs/api/configs/brand.md +43 -0
  10. package/docs/api/configs/cdn.md +35 -0
  11. package/docs/api/configs/color.md +144 -0
  12. package/docs/api/configs/env.md +120 -0
  13. package/docs/api/configs/index.md +394 -0
  14. package/docs/api/configs/link.md +33 -0
  15. package/docs/api/configs/log.md +27 -0
  16. package/docs/api/configs/mp.md +34 -0
  17. package/docs/api/configs/navigate.md +27 -0
  18. package/docs/api/configs/page.md +32 -0
  19. package/docs/api/configs/path.md +27 -0
  20. package/docs/api/configs/storage.md +24 -0
  21. package/docs/api/configs/tabbar.md +29 -0
  22. package/docs/api/configs/toast.md +35 -0
  23. package/docs/api/configs/update.md +25 -0
  24. package/docs/api/configs/upload.md +45 -0
  25. package/docs/api/configs/ver.md +32 -0
  26. package/docs/api/configs/web.md +28 -0
  27. package/docs/api/hooks/index.md +182 -0
  28. package/docs/api/hooks/useI18n.md +27 -0
  29. package/docs/api/hooks/useOverlay.md +37 -0
  30. package/docs/api/hooks/usePopup.md +35 -0
  31. package/docs/api/hooks/useVersion.md +23 -0
  32. package/docs/api/index.md +269 -0
  33. package/docs/api/mixins/app.md +29 -0
  34. package/docs/api/mixins/badge.md +23 -0
  35. package/docs/api/mixins/debounce.md +32 -0
  36. package/docs/api/mixins/deep.md +29 -0
  37. package/docs/api/mixins/index.md +23 -0
  38. package/docs/api/mixins/login.md +22 -0
  39. package/docs/api/mixins/model.md +26 -0
  40. package/docs/api/mixins/redirect.md +26 -0
  41. package/docs/api/mixins/share.md +29 -0
  42. package/docs/api/mixins/show.md +27 -0
  43. package/docs/api/mixins/webview.md +27 -0
  44. package/docs/api/modules/app.md +30 -0
  45. package/docs/api/modules/dict.md +28 -0
  46. package/docs/api/modules/im.md +22 -0
  47. package/docs/api/modules/index.md +44 -0
  48. package/docs/api/modules/launch.md +26 -0
  49. package/docs/api/modules/location.md +25 -0
  50. package/docs/api/modules/login.md +35 -0
  51. package/docs/api/modules/network.md +26 -0
  52. package/docs/api/modules/system.md +29 -0
  53. package/docs/api/utils/audio.md +84 -0
  54. package/docs/api/utils/consts.md +201 -0
  55. package/docs/api/utils/cos.md +269 -0
  56. package/docs/api/utils/debounce.md +89 -0
  57. package/docs/api/utils/file.md +78 -0
  58. package/docs/api/utils/index.md +547 -0
  59. package/docs/api/utils/locale.md +32 -0
  60. package/docs/api/utils/message.md +81 -0
  61. package/docs/api/utils/navigate.md +267 -0
  62. package/docs/api/utils/pages.md +205 -0
  63. package/docs/api/utils/permission.md +28 -0
  64. package/docs/api/utils/permit.md +62 -0
  65. package/docs/api/utils/query.md +89 -0
  66. package/docs/api/utils/request.md +34 -0
  67. package/docs/api/utils/storage.md +145 -0
  68. package/docs/api/utils/subscribe.md +77 -0
  69. package/docs/api/utils/throttle.md +101 -0
  70. package/docs/api/utils/toast.md +164 -0
  71. package/docs/api/utils/uni.md +28 -0
  72. package/docs/api/utils/update.md +165 -0
  73. package/docs/components/g-back-button.md +76 -0
  74. package/docs/components/g-checkbox-list.md +101 -0
  75. package/docs/components/g-container.md +93 -0
  76. package/docs/components/g-data-list.md +106 -0
  77. package/docs/components/g-dot-text.md +79 -0
  78. package/docs/components/g-env.md +75 -0
  79. package/docs/components/g-float.md +83 -0
  80. package/docs/components/g-grid-image.md +91 -0
  81. package/docs/components/g-grid-swiper.md +99 -0
  82. package/docs/components/g-icon.md +106 -0
  83. package/docs/components/g-mask.md +82 -0
  84. package/docs/components/g-money.md +90 -0
  85. package/docs/components/g-more.md +78 -0
  86. package/docs/components/g-page-container.md +170 -0
  87. package/docs/components/g-permission-popup.md +117 -0
  88. package/docs/components/g-polyline-chat.md +102 -0
  89. package/docs/components/g-polyline-view.md +67 -0
  90. package/docs/components/g-popup.md +144 -0
  91. package/docs/components/g-refresh-view.md +118 -0
  92. package/docs/components/g-render-image.md +83 -0
  93. package/docs/components/g-search.md +120 -0
  94. package/docs/components/g-share-photo.md +77 -0
  95. package/docs/components/g-share-view.md +83 -0
  96. package/docs/components/g-share-weixin.md +81 -0
  97. package/docs/components/g-skeleton-view.md +71 -0
  98. package/docs/components/g-skeleton.md +64 -0
  99. package/docs/components/g-tag-editor.md +134 -0
  100. package/docs/components/g-timer.md +72 -0
  101. package/docs/components/g-trtc-room.md +116 -0
  102. package/docs/components/g-trtc-tui.md +84 -0
  103. package/docs/components/g-trtc.md +124 -0
  104. package/docs/components/g-upload.md +117 -0
  105. package/docs/components/g-waterfall.md +84 -0
  106. package/docs/components/index.md +109 -0
  107. package/docs/components/styles/base-styles.md +367 -0
  108. package/docs/components/styles/global-vars.md +150 -0
  109. package/docs/components/usage.md +112 -0
  110. package/docs/faq/index.md +78 -0
  111. package/docs/guide/getting-started.md +195 -0
  112. package/docs/guide/project-frame.md +297 -0
  113. package/docs/index.md +80 -0
  114. package/lib/apis/core.d.ts +12 -0
  115. package/lib/apis/core.js +13 -0
  116. package/lib/apis/index.d.ts +2 -0
  117. package/lib/apis/index.js +2 -0
  118. package/lib/apis/request.d.ts +4 -0
  119. package/lib/apis/request.js +27 -0
  120. package/lib/components/g-back-button/g-back-button.vue +141 -0
  121. package/lib/components/g-checkbox-list/g-checkbox-list.vue +156 -0
  122. package/lib/components/g-container/g-container.vue +159 -0
  123. package/lib/components/g-data-list/g-data-list.vue +192 -0
  124. package/lib/components/g-dot-text/g-dot-text.vue +114 -0
  125. package/lib/components/g-env/g-env.vue +123 -0
  126. package/lib/components/g-float/g-float.vue +131 -0
  127. package/lib/components/g-grid-image/g-grid-image.vue +84 -0
  128. package/lib/components/g-grid-swiper/g-grid-swiper.vue +224 -0
  129. package/lib/components/g-icon/g-icon.vue +72 -0
  130. package/lib/components/g-mask/g-mask.vue +126 -0
  131. package/lib/components/g-money/g-money.vue +174 -0
  132. package/lib/components/g-more/g-more.vue +68 -0
  133. package/lib/components/g-page-container/g-page-container.vue +470 -0
  134. package/lib/components/g-permission-popup/g-permission-popup.vue +80 -0
  135. package/lib/components/g-polyline-chat/g-polyline-chat.vue +255 -0
  136. package/lib/components/g-polyline-view/g-polyline-view.vue +104 -0
  137. package/lib/components/g-popup/g-popup.vue +449 -0
  138. package/lib/components/g-refresh-view/g-refresh-view.vue +213 -0
  139. package/lib/components/g-render-image/g-render-image.vue +222 -0
  140. package/lib/components/g-search/g-search.vue +274 -0
  141. package/lib/components/g-share-photo/g-share-photo.vue +75 -0
  142. package/lib/components/g-share-view/g-share-view.vue +157 -0
  143. package/lib/components/g-share-weixin/g-share-weixin.vue +106 -0
  144. package/lib/components/g-skeleton/g-skeleton.vue +55 -0
  145. package/lib/components/g-skeleton-view/g-skeleton-view.vue +78 -0
  146. package/lib/components/g-tag-editor/g-tag-editor.vue +482 -0
  147. package/lib/components/g-timer/g-timer.vue +61 -0
  148. package/lib/components/g-trtc/g-trtc.vue +347 -0
  149. package/lib/components/g-trtc-room/g-trtc-room.vue +524 -0
  150. package/lib/components/g-trtc-room/iconfont.scss +59 -0
  151. package/lib/components/g-trtc-tui/g-trtc-tui.vue +245 -0
  152. package/lib/components/g-upload/g-upload.vue +294 -0
  153. package/lib/components/g-waterfall/g-waterfall.vue +101 -0
  154. package/lib/configs/api.d.ts +7 -0
  155. package/lib/configs/api.js +6 -0
  156. package/lib/configs/app.d.ts +26 -0
  157. package/lib/configs/app.js +50 -0
  158. package/lib/configs/brand.d.ts +22 -0
  159. package/lib/configs/brand.js +26 -0
  160. package/lib/configs/cdn.d.ts +13 -0
  161. package/lib/configs/cdn.js +12 -0
  162. package/lib/configs/color.d.ts +62 -0
  163. package/lib/configs/color.js +66 -0
  164. package/lib/configs/env.d.ts +37 -0
  165. package/lib/configs/env.js +71 -0
  166. package/lib/configs/index.d.ts +170 -0
  167. package/lib/configs/index.js +82 -0
  168. package/lib/configs/link.d.ts +11 -0
  169. package/lib/configs/link.js +3 -0
  170. package/lib/configs/log.d.ts +9 -0
  171. package/lib/configs/log.js +8 -0
  172. package/lib/configs/mp.d.ts +15 -0
  173. package/lib/configs/mp.js +9 -0
  174. package/lib/configs/navigate.d.ts +17 -0
  175. package/lib/configs/navigate.js +5 -0
  176. package/lib/configs/page.d.ts +18 -0
  177. package/lib/configs/page.js +14 -0
  178. package/lib/configs/path.d.ts +11 -0
  179. package/lib/configs/path.js +10 -0
  180. package/lib/configs/storage.d.ts +7 -0
  181. package/lib/configs/storage.js +6 -0
  182. package/lib/configs/tabbar.d.ts +7 -0
  183. package/lib/configs/tabbar.js +6 -0
  184. package/lib/configs/toast.d.ts +18 -0
  185. package/lib/configs/toast.js +29 -0
  186. package/lib/configs/update.d.ts +45 -0
  187. package/lib/configs/update.js +6 -0
  188. package/lib/configs/upload.d.ts +30 -0
  189. package/lib/configs/upload.js +7 -0
  190. package/lib/configs/ver.d.ts +8 -0
  191. package/lib/configs/ver.js +28 -0
  192. package/lib/configs/web.d.ts +5 -0
  193. package/lib/configs/web.js +2 -0
  194. package/lib/hooks/index.d.ts +4 -0
  195. package/lib/hooks/index.js +4 -0
  196. package/lib/hooks/useI18n.d.ts +2 -0
  197. package/lib/hooks/useI18n.js +19 -0
  198. package/lib/hooks/useOverlay.d.ts +1 -0
  199. package/lib/hooks/useOverlay.js +17 -0
  200. package/lib/hooks/usePopup.d.ts +1 -0
  201. package/lib/hooks/usePopup.js +14 -0
  202. package/lib/hooks/useVersion.d.ts +6 -0
  203. package/lib/hooks/useVersion.js +21 -0
  204. package/lib/index.d.ts +26 -0
  205. package/lib/index.js +33 -0
  206. package/lib/mixins/app.d.ts +14 -0
  207. package/lib/mixins/app.js +105 -0
  208. package/lib/mixins/badge.d.ts +24 -0
  209. package/lib/mixins/badge.js +44 -0
  210. package/lib/mixins/debounce.d.ts +6 -0
  211. package/lib/mixins/debounce.js +11 -0
  212. package/lib/mixins/deep.d.ts +6 -0
  213. package/lib/mixins/deep.js +8 -0
  214. package/lib/mixins/index.d.ts +8 -0
  215. package/lib/mixins/index.js +8 -0
  216. package/lib/mixins/login.d.ts +4 -0
  217. package/lib/mixins/login.js +25 -0
  218. package/lib/mixins/model.d.ts +22 -0
  219. package/lib/mixins/model.js +29 -0
  220. package/lib/mixins/redirect.d.ts +8 -0
  221. package/lib/mixins/redirect.js +94 -0
  222. package/lib/mixins/share.d.ts +15 -0
  223. package/lib/mixins/share.js +55 -0
  224. package/lib/mixins/show.d.ts +9 -0
  225. package/lib/mixins/show.js +16 -0
  226. package/lib/mixins/webview.d.ts +26 -0
  227. package/lib/mixins/webview.js +225 -0
  228. package/lib/modules/app.d.ts +5 -0
  229. package/lib/modules/app.js +19 -0
  230. package/lib/modules/dict.d.ts +8 -0
  231. package/lib/modules/dict.js +43 -0
  232. package/lib/modules/im.d.ts +6 -0
  233. package/lib/modules/im.js +105 -0
  234. package/lib/modules/index.d.ts +8 -0
  235. package/lib/modules/index.js +8 -0
  236. package/lib/modules/launch.d.ts +5 -0
  237. package/lib/modules/launch.js +32 -0
  238. package/lib/modules/location.d.ts +5 -0
  239. package/lib/modules/location.js +57 -0
  240. package/lib/modules/login.d.ts +5 -0
  241. package/lib/modules/login.js +72 -0
  242. package/lib/modules/network.d.ts +5 -0
  243. package/lib/modules/network.js +39 -0
  244. package/lib/modules/system.d.ts +5 -0
  245. package/lib/modules/system.js +65 -0
  246. package/lib/styles/animate-vue.scss +3 -0
  247. package/lib/styles/animate.scss +27 -0
  248. package/lib/styles/bg-vue.scss +21 -0
  249. package/lib/styles/bg.scss +93 -0
  250. package/lib/styles/border.scss +218 -0
  251. package/lib/styles/flex-nvue.scss +64 -0
  252. package/lib/styles/flex-vue.scss +75 -0
  253. package/lib/styles/font.scss +59 -0
  254. package/lib/styles/index.scss +25 -0
  255. package/lib/styles/layout-nvue.scss +24 -0
  256. package/lib/styles/layout-vue.scss +30 -0
  257. package/lib/styles/layout.scss +76 -0
  258. package/lib/styles/opacity.scss +10 -0
  259. package/lib/styles/reset-vue.scss +46 -0
  260. package/lib/styles/shadow.scss +12 -0
  261. package/lib/styles/sizing-vue.scss +21 -0
  262. package/lib/styles/sizing.scss +21 -0
  263. package/lib/styles/spacing.scss +234 -0
  264. package/lib/styles/text-nvue.scss +21 -0
  265. package/lib/styles/text-vue.scss +70 -0
  266. package/lib/styles/text.scss +122 -0
  267. package/lib/styles/var.module.scss +29 -0
  268. package/lib/utils/audio.d.ts +14 -0
  269. package/lib/utils/audio.js +43 -0
  270. package/lib/utils/consts.d.ts +30 -0
  271. package/lib/utils/consts.js +52 -0
  272. package/lib/utils/cos.d.ts +15 -0
  273. package/lib/utils/cos.js +140 -0
  274. package/lib/utils/debounce.d.ts +2 -0
  275. package/lib/utils/debounce.js +30 -0
  276. package/lib/utils/file.d.ts +28 -0
  277. package/lib/utils/file.js +292 -0
  278. package/lib/utils/index.d.ts +166 -0
  279. package/lib/utils/index.js +485 -0
  280. package/lib/utils/locale.d.ts +6 -0
  281. package/lib/utils/locale.js +19 -0
  282. package/lib/utils/message.d.ts +9 -0
  283. package/lib/utils/message.js +63 -0
  284. package/lib/utils/navigate.d.ts +27 -0
  285. package/lib/utils/navigate.js +183 -0
  286. package/lib/utils/pages.d.ts +21 -0
  287. package/lib/utils/pages.js +79 -0
  288. package/lib/utils/permission.d.ts +16 -0
  289. package/lib/utils/permission.js +291 -0
  290. package/lib/utils/permit.d.ts +30 -0
  291. package/lib/utils/permit.js +181 -0
  292. package/lib/utils/query.d.ts +13 -0
  293. package/lib/utils/query.js +14 -0
  294. package/lib/utils/request.d.ts +8 -0
  295. package/lib/utils/request.js +126 -0
  296. package/lib/utils/storage.d.ts +53 -0
  297. package/lib/utils/storage.js +145 -0
  298. package/lib/utils/subscribe.d.ts +7 -0
  299. package/lib/utils/subscribe.js +94 -0
  300. package/lib/utils/throttle.d.ts +2 -0
  301. package/lib/utils/throttle.js +32 -0
  302. package/lib/utils/toast.d.ts +17 -0
  303. package/lib/utils/toast.js +66 -0
  304. package/lib/utils/uni.d.ts +1 -0
  305. package/lib/utils/uni.js +147 -0
  306. package/lib/utils/update.d.ts +9 -0
  307. package/lib/utils/update.js +376 -0
  308. package/package.json +49 -0
  309. package/types/index.d.ts +25 -0
  310. package/types/virtual.d.ts +1 -0
@@ -0,0 +1,24 @@
1
+ # storage
2
+
3
+ 缓存配置。发布路径:`@zfqh/uniapp/lib/configs/storage`
4
+
5
+ | 字段 | 类型 | 默认值 | 说明 |
6
+ | --- | --- | --- | --- |
7
+ | `prefix` | `string` | `gmcb` | 本地缓存 key 前缀。 |
8
+
9
+ ## 基本使用
10
+
11
+ 为不同项目或品牌设置缓存前缀,避免同一设备上多个端的本地缓存互相覆盖。
12
+
13
+ ```ts
14
+ import { defineConfig, setStorageSync, getStorageSync } from '@zfqh/uniapp';
15
+
16
+ defineConfig({
17
+ storage: {
18
+ prefix: 'zfqh-patient',
19
+ },
20
+ });
21
+
22
+ setStorageSync('userInfo', { id: 1, name: '张三' });
23
+ const userInfo = getStorageSync('userInfo');
24
+ ```
@@ -0,0 +1,29 @@
1
+ # tabbar
2
+
3
+ tabBar 配置。发布路径:`@zfqh/uniapp/lib/configs/tabbar`
4
+
5
+ | 字段 | 类型 | 默认值 | 说明 |
6
+ | --- | --- | --- | --- |
7
+ | `badgeIndex` | `number` | `-1` | 消息角标所在 tabBar 索引,小于等于 0 时不设置。 |
8
+
9
+ ## 基本使用
10
+
11
+ 患者端首页、消息页等使用 `badge` mixin 时,会根据 `tabbar.badgeIndex` 自动更新未读角标。
12
+
13
+ ```ts
14
+ import { defineConfig } from '@zfqh/uniapp';
15
+
16
+ defineConfig({
17
+ tabbar: {
18
+ badgeIndex: 1,
19
+ },
20
+ });
21
+ ```
22
+
23
+ ```ts
24
+ import { badge } from '@zfqh/uniapp/lib/mixins';
25
+
26
+ export default {
27
+ mixins: [badge],
28
+ };
29
+ ```
@@ -0,0 +1,35 @@
1
+ # toast
2
+
3
+ 提示配置。发布路径:`@zfqh/uniapp/lib/configs/toast`
4
+
5
+ | 字段 | 类型 | 默认值 | 说明 |
6
+ | --- | --- | --- | --- |
7
+ | `custom` | `boolean` | `false` | 是否启用页面 $refs.toast 自定义提示。 |
8
+ | `show(options)` | `function` | `-` | 自定义 toast 显示函数,返回 true 表示已接管。 |
9
+ | `hide()` | `function` | `-` | 自定义 toast 隐藏函数,返回 true 表示已接管。 |
10
+
11
+ ## 基本使用
12
+
13
+ 默认使用 `uni.showToast`。如果项目有全局自定义 Toast 组件,可以在配置中接管显示和隐藏。
14
+
15
+ ```ts
16
+ import { defineConfig, toast } from '@zfqh/uniapp';
17
+
18
+ defineConfig({
19
+ toast: {
20
+ custom: true,
21
+ show(options) {
22
+ const page = getCurrentPages().at(-1) as any;
23
+ page?.$vm?.$refs?.toast?.show(options);
24
+ return true;
25
+ },
26
+ hide() {
27
+ const page = getCurrentPages().at(-1) as any;
28
+ page?.$vm?.$refs?.toast?.hide();
29
+ return true;
30
+ },
31
+ },
32
+ });
33
+
34
+ toast.success('保存成功');
35
+ ```
@@ -0,0 +1,25 @@
1
+ # update
2
+
3
+ 更新配置。发布路径:`@zfqh/uniapp/lib/configs/update`
4
+
5
+ | 字段 | 类型 | 默认值 | 说明 |
6
+ | --- | --- | --- | --- |
7
+ | `request(data)` | `function` | `Promise<null>` | 获取最新版本信息;返回 hot_update、force_update、wgt_url/apk_url/ipa_url/zip_url 等字段。 |
8
+
9
+ ## 基本使用
10
+
11
+ App.vue 全局 mixin 会在合适时机调用更新检查;业务项目只需要配置获取最新版本的请求函数。
12
+
13
+ ```ts
14
+ import { defineConfig } from '@zfqh/uniapp';
15
+ import { POST } from '@zfqh/uniapp/lib/apis';
16
+
17
+ defineConfig({
18
+ update: {
19
+ async request(data) {
20
+ const { data: version } = await POST('/app-api/system/app/version/get-last-version', data);
21
+ return version;
22
+ },
23
+ },
24
+ });
25
+ ```
@@ -0,0 +1,45 @@
1
+ # upload
2
+
3
+ 上传配置。发布路径:`@zfqh/uniapp/lib/configs/upload`
4
+
5
+ | 字段 | 类型 | 默认值 | 说明 |
6
+ | --- | --- | --- | --- |
7
+ | `request(params)` | `function` | `Promise<null>` | 获取上传凭证;COS 上传会以 { mode: "cos" } 调用。 |
8
+
9
+ COS 上传需要 `request` 返回:
10
+
11
+ | 字段 | 说明 |
12
+ | --- | --- |
13
+ | `secret_id` | 腾讯云临时密钥 ID,常由后端 `tmpSecretId` 映射而来。 |
14
+ | `secret_key` | 腾讯云临时密钥 Key,常由后端 `tmpSecretKey` 映射而来。 |
15
+ | `session_token` | 临时 token,常由后端 `sessionToken` 映射而来。 |
16
+ | `create_time` | 临时密钥创建时间,常由后端 `createTime` 映射而来。 |
17
+ | `expire_time` | 临时密钥过期时间,常由后端 `expirationTime` 映射而来。 |
18
+ | `bucket` | COS bucket。 |
19
+ | `region` | COS region;如启用全球加速可传 `accelerate`。 |
20
+
21
+ ## 基本使用
22
+
23
+ 患者端和商户端上传图片时,通常从后端获取腾讯云临时密钥,并映射成 COS 工具需要的字段。
24
+
25
+ ```ts
26
+ import { defineConfig } from '@zfqh/uniapp';
27
+ import { getTencentToken } from '@zfqh/uniapp/lib/apis';
28
+
29
+ defineConfig({
30
+ upload: {
31
+ async request() {
32
+ const { data } = await getTencentToken();
33
+ return {
34
+ secret_id: data.tmpSecretId,
35
+ secret_key: data.tmpSecretKey,
36
+ session_token: data.sessionToken,
37
+ create_time: data.createTime,
38
+ expire_time: data.expirationTime,
39
+ bucket: data.bucket,
40
+ region: data.region,
41
+ };
42
+ },
43
+ },
44
+ });
45
+ ```
@@ -0,0 +1,32 @@
1
+ # ver
2
+
3
+ 版本配置。发布路径:`@zfqh/uniapp/lib/configs/ver`
4
+
5
+ | 字段 | 类型 | 默认值 | 说明 |
6
+ | --- | --- | --- | --- |
7
+ | `code` | `number` | `0` | 资源版本号。 |
8
+ | `name` | `string` | `''` | 资源版本名。 |
9
+ | `suffix` | `string` | `''` | 版本名后缀。 |
10
+
11
+ ## 基本使用
12
+
13
+ 商户端环境文件会按环境维护版本号,页面或更新逻辑可读取 `config.ver` 展示当前版本。
14
+
15
+ ```ts
16
+ // env/.env.sit.ts
17
+ import { defineEnvConfig } from '@zfqh/uniapp';
18
+
19
+ export default defineEnvConfig({
20
+ ver: {
21
+ code: 817,
22
+ name: '1.8.17',
23
+ suffix: 'sit',
24
+ },
25
+ });
26
+ ```
27
+
28
+ ```ts
29
+ import { config } from '@zfqh/uniapp';
30
+
31
+ console.log(`${config.ver.name}.${config.ver.code}`);
32
+ ```
@@ -0,0 +1,28 @@
1
+ # web
2
+
3
+ Web 资源配置。发布路径:`@zfqh/uniapp/lib/configs/web`
4
+
5
+ | 字段 | 类型 | 默认值 | 说明 |
6
+ | --- | --- | --- | --- |
7
+ | `[key]` | `string` | `-` | webview 自定义协议 app 到静态站点入口的映射。 |
8
+
9
+ ## 基本使用
10
+
11
+ 商户端和患者端都会把 H5 报告、协议或活动页面放入 webview 承载页,`web` 配置用于按业务 app key 找到对应 H5 入口。
12
+
13
+ ```ts
14
+ import { defineConfig, config, navigate } from '@zfqh/uniapp';
15
+
16
+ defineConfig({
17
+ web: {
18
+ patient: 'https://h5.example.com/patient',
19
+ merchant: 'https://h5.example.com/merchant',
20
+ },
21
+ });
22
+
23
+ export function openHealthReport(id: string, familyId: string) {
24
+ navigate('/pages/webview/webview', {
25
+ url: `${config.web.patient}/#/pages/healthReport/healthReport?id=${id}&familyId=${familyId}`,
26
+ });
27
+ }
28
+ ```
@@ -0,0 +1,182 @@
1
+ # Hooks 参考
2
+
3
+ 发布路径:`@zfqh/uniapp/lib/hooks`。根入口已通过 `export * from './hooks'` 导出全部 hooks。
4
+
5
+ Hooks 运行在组件 setup 上下文中。如果 hook 内需要访问 Vuex,请使用 `useStore()`:
6
+
7
+ ```ts
8
+ import { useStore } from 'vuex';
9
+
10
+ const store = useStore();
11
+ ```
12
+
13
+ `uni.$store` 主要用于请求、导航、权限、webview 消息等普通模块。
14
+
15
+ | Hook | 说明 |
16
+ | --- | --- |
17
+ | `useOverlay(visible = false, delay = 300)` | 返回 [showOverlay, showChildren]。showOverlay 控制遮罩是否可见;关闭后 showChildren 会延迟 delay 毫秒变为 false,适合等待关闭动画结束再卸载内容。 |
18
+ | `usePopup(visible)` | 接收一个 ref/响应式可见状态,返回 popup ref;visible 为 true 时调用 popup.open(),false 时调用 popup.close()。 |
19
+ | `useVersion()` | 返回 { version },version 包含 name/code;App 端会通过 plus.runtime.getProperty 补齐版本信息。 |
20
+ | `useI18n()` | 非 nvue 直接使用 vue-i18n 的 useI18n;nvue 下返回注入的 t 与本地 locale ref。 |
21
+
22
+ ## 示例
23
+
24
+ ```ts
25
+ import { ref } from 'vue';
26
+ import { useOverlay, usePopup, useVersion, useI18n } from '@zfqh/uniapp';
27
+
28
+ const [showOverlay, showChildren] = useOverlay(false, 300);
29
+ const visible = ref(false);
30
+ const popup = usePopup(visible);
31
+ const { version } = useVersion();
32
+ const { t } = useI18n();
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Hooks 使用指南
38
+
39
+ 根入口导出 `@zfqh/uniapp/lib/hooks` 下的四个组合式函数:
40
+
41
+ ```ts
42
+ import { useOverlay, usePopup, useVersion, useI18n } from '@zfqh/uniapp';
43
+ ```
44
+
45
+ ## Store 用法
46
+
47
+ Hooks 运行在组件 setup 上下文中,需要读取 Vuex 时请使用 `useStore()`,不要直接读取 `uni.$store`:
48
+
49
+ ```ts
50
+ import { computed } from 'vue';
51
+ import { useStore } from 'vuex';
52
+
53
+ export function useUserName() {
54
+ const store = useStore();
55
+
56
+ return computed(() => store.state.login.info?.userName || '');
57
+ }
58
+ ```
59
+
60
+ `uni.$store` 主要给请求、导航、权限、webview 消息等非组件上下文的普通模块使用。完整约定见 [Store 使用位置](./../../guide/project-frame#store-使用位置)。
61
+
62
+ ## useOverlay
63
+
64
+ 用于遮罩动画场景,让外层遮罩和内部内容分开控制。`delay` 参数用于在遮罩关闭动画完成后再卸载内容,避免内容突然消失。
65
+
66
+ ```ts
67
+ const [showOverlay, showChildren] = useOverlay(false, 300);
68
+
69
+ showOverlay.value = true;
70
+ showOverlay.value = false;
71
+ ```
72
+
73
+ | 参数 | 默认值 | 说明 |
74
+ | --- | --- | --- |
75
+ | `visible` | `false` | 初始显示状态。 |
76
+ | `delay` | `300` | 遮罩关闭后,内部内容延迟卸载时间(毫秒)。 |
77
+
78
+ 返回:
79
+
80
+ | 返回值 | 说明 |
81
+ | --- | --- |
82
+ | `showOverlay` | 控制遮罩是否显示。 |
83
+ | `showChildren` | 控制内容是否渲染。 |
84
+
85
+ ```vue
86
+ <template>
87
+ <!-- 遮罩层 -->
88
+ <uv-overlay :show="showOverlay" @click="close" />
89
+ <!-- 内容层:延迟卸载以配合关闭动画 -->
90
+ <view v-if="showChildren" class="popup-content">
91
+ <text>弹窗内容</text>
92
+ </view>
93
+ </template>
94
+
95
+ <script setup>
96
+ import { useOverlay } from '@zfqh/uniapp';
97
+
98
+ const [showOverlay, showChildren] = useOverlay(false, 300);
99
+
100
+ function open() {
101
+ showChildren.value = true; // 先渲染内容
102
+ showOverlay.value = true; // 再显示遮罩
103
+ }
104
+
105
+ function close() {
106
+ showOverlay.value = false; // 先关闭遮罩
107
+ // 300ms 后 showChildren 自动变为 false(卸载内容)
108
+ setTimeout(() => { showChildren.value = false; }, 300);
109
+ }
110
+ </script>
111
+ ```
112
+
113
+ ## usePopup
114
+
115
+ 用于绑定 `uni-popup` 或类似组件,自动监听 `visible` 变化并调用 `open/close`:
116
+
117
+ ```vue
118
+ <template>
119
+ <uni-popup ref="popup" @close="visible = false">内容</uni-popup>
120
+ </template>
121
+
122
+ <script setup lang="ts">
123
+ import { ref } from 'vue';
124
+ import { usePopup } from '@zfqh/uniapp';
125
+
126
+ const visible = ref(false);
127
+ const popup = usePopup(visible);
128
+
129
+ function open() {
130
+ visible.value = true; // 自动调用 popup.value.open()
131
+ }
132
+ </script>
133
+ ```
134
+
135
+ 当 `visible` 为 true 时自动调用 `popup.value.open()`,为 false 时调用 `popup.value.close()`。注意在 `@close` 回调中同步 `visible = false`,避免状态不一致。
136
+
137
+ ## useVersion
138
+
139
+ 返回响应式版本信息:
140
+
141
+ ```ts
142
+ import { useVersion } from '@zfqh/uniapp';
143
+
144
+ const { version } = useVersion();
145
+
146
+ console.log(version.name); // '1.0.0'
147
+ console.log(version.code); // 100
148
+ ```
149
+
150
+ | 平台 | 行为 |
151
+ | --- | --- |
152
+ | App | 通过 `plus.runtime.getProperty` 读取版本 |
153
+ | 非 App | 优先读取 `config.ver.name` 和 `config.ver.code` |
154
+
155
+ 在页面中显示版本号:
156
+
157
+ ```vue
158
+ <template>
159
+ <text>v{{ version.name }}({{ version.code }})</text>
160
+ </template>
161
+ ```
162
+
163
+ ## useI18n
164
+
165
+ 统一处理 APP-NVUE 和其他端的国际化调用:
166
+
167
+ ```ts
168
+ import { useI18n } from '@zfqh/uniapp';
169
+
170
+ const { t, locale } = useI18n();
171
+ ```
172
+
173
+ | 平台 | 行为 |
174
+ | --- | --- |
175
+ | APP-NVUE | 使用内部 `inject('t')` 和 `showLocale`。 |
176
+ | 其他平台 | 透传 `vue-i18n` 的 `useI18n`。 |
177
+
178
+ ```vue
179
+ <template>
180
+ <text>{{ t('common.submit') }}</text>
181
+ </template>
182
+ ```
@@ -0,0 +1,27 @@
1
+ # useI18n
2
+
3
+ 发布路径:`@zfqh/uniapp/lib/hooks/useI18n`。
4
+
5
+ | `useI18n()` | 非 nvue 直接使用 vue-i18n 的 useI18n;nvue 下返回注入的 t 与本地 locale ref。 |
6
+
7
+ ## 基本使用
8
+
9
+ 页面中需要同时兼容 vue 页面和 nvue 页面时,使用包内 `useI18n` 获取翻译函数。
10
+
11
+ ```vue
12
+ <template>
13
+ <view>{{ t('请选择设备') }}</view>
14
+ </template>
15
+
16
+ <script setup>
17
+ import { useI18n } from '@zfqh/uniapp';
18
+
19
+ const { t, locale } = useI18n();
20
+
21
+ function switchToZh() {
22
+ locale.value = 'zh-CN';
23
+ }
24
+ </script>
25
+ ```
26
+
27
+ 详见 [Hooks 概览](./)。
@@ -0,0 +1,37 @@
1
+ # useOverlay
2
+
3
+ 发布路径:`@zfqh/uniapp/lib/hooks/useOverlay`。
4
+
5
+ | `useOverlay(visible = false, delay = 300)` | 返回 [showOverlay, showChildren]。showOverlay 控制遮罩是否可见;关闭后 showChildren 会延迟 delay 毫秒变为 false,适合等待关闭动画结束再卸载内容。 |
6
+
7
+ ## 基本使用
8
+
9
+ 患者端体质辨识流程中常用遮罩承载拍照、脉诊等步骤弹层。
10
+
11
+ ```vue
12
+ <template>
13
+ <view v-if="showOverlay" class="overlay" @click="close">
14
+ <view v-if="showChildren" class="panel">
15
+ <slot />
16
+ </view>
17
+ </view>
18
+ </template>
19
+
20
+ <script setup>
21
+ import { useOverlay } from '@zfqh/uniapp';
22
+
23
+ const [showOverlay, showChildren] = useOverlay(false, 300);
24
+
25
+ function open() {
26
+ showOverlay.value = true;
27
+ showChildren.value = true;
28
+ }
29
+
30
+ function close() {
31
+ showChildren.value = false;
32
+ showOverlay.value = false;
33
+ }
34
+ </script>
35
+ ```
36
+
37
+ 详见 [Hooks 概览](./)。
@@ -0,0 +1,35 @@
1
+ # usePopup
2
+
3
+ 发布路径:`@zfqh/uniapp/lib/hooks/usePopup`。
4
+
5
+ | `usePopup(visible)` | 接收一个 ref/响应式可见状态,返回 popup ref;visible 为 true 时调用 popup.open(),false 时调用 popup.close()。 |
6
+
7
+ ## 基本使用
8
+
9
+ 适合把 `uv-popup` 的命令式 open/close 同步为响应式状态。
10
+
11
+ ```vue
12
+ <template>
13
+ <uv-popup ref="popup" mode="center">
14
+ <view class="confirm">确认核销会员权益?</view>
15
+ </uv-popup>
16
+ </template>
17
+
18
+ <script setup>
19
+ import { ref } from 'vue';
20
+ import { usePopup } from '@zfqh/uniapp';
21
+
22
+ const visible = ref(false);
23
+ const popup = usePopup(visible);
24
+
25
+ function openVerifyPopup() {
26
+ visible.value = true;
27
+ }
28
+
29
+ function closeVerifyPopup() {
30
+ visible.value = false;
31
+ }
32
+ </script>
33
+ ```
34
+
35
+ 详见 [Hooks 概览](./)。
@@ -0,0 +1,23 @@
1
+ # useVersion
2
+
3
+ 发布路径:`@zfqh/uniapp/lib/hooks/useVersion`。
4
+
5
+ | `useVersion()` | 返回 { version },version 包含 name/code;App 端会通过 plus.runtime.getProperty 补齐版本信息。 |
6
+
7
+ ## 基本使用
8
+
9
+ 用于设置页、下载页或更新弹窗展示当前 App 版本。
10
+
11
+ ```vue
12
+ <template>
13
+ <view>当前版本:{{ version.name }}({{ version.code }})</view>
14
+ </template>
15
+
16
+ <script setup>
17
+ import { useVersion } from '@zfqh/uniapp';
18
+
19
+ const { version } = useVersion();
20
+ </script>
21
+ ```
22
+
23
+ 详见 [Hooks 概览](./)。