tmui-cli 2.0.3 → 2.0.4

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 (1160) hide show
  1. package/README.md +22 -14
  2. package/data/components.json +1 -1
  3. package/data/config.json +1 -1
  4. package/data/doc-index.json +1 -1
  5. package/data/tmui4x-doc-index.json +1 -1
  6. package/data/uni-app-x-docs/.vuepress/components/md/banner.vue +241 -0
  7. package/data/uni-app-x-docs/.vuepress/components/md/hperm.vue +59 -0
  8. package/data/uni-app-x-docs/.vuepress/components/md/virtual.vue +49 -0
  9. package/data/uni-app-x-docs/.vuepress/config/copy.js +7 -0
  10. package/data/uni-app-x-docs/.vuepress/config/footer.js +220 -0
  11. package/data/uni-app-x-docs/.vuepress/config/help.js +4 -0
  12. package/data/uni-app-x-docs/.vuepress/config/i18n/index.js +2 -0
  13. package/data/uni-app-x-docs/.vuepress/config/navbar.js +144 -0
  14. package/data/uni-app-x-docs/.vuepress/config/redirectRouter.js +35 -0
  15. package/data/uni-app-x-docs/.vuepress/config/routerMap.js +30 -0
  16. package/data/uni-app-x-docs/.vuepress/config/searchPage.js +53 -0
  17. package/data/uni-app-x-docs/.vuepress/config/siderbar/index.js +6 -0
  18. package/data/uni-app-x-docs/.vuepress/config/siderbar/uni-app-x.js +69 -0
  19. package/data/uni-app-x-docs/.vuepress/config/toc.js +13 -0
  20. package/data/uni-app-x-docs/.vuepress/config.js +130 -0
  21. package/data/uni-app-x-docs/.vuepress/markdown/inject-json-to-md.js +248 -0
  22. package/data/uni-app-x-docs/.vuepress/public/baidu.js +7 -0
  23. package/data/uni-app-x-docs/.vuepress/public/h5/hybrid/html/local.html +88 -0
  24. package/data/uni-app-x-docs/.vuepress/public/h5/index.html +14 -0
  25. package/data/uni-app-x-docs/.vuepress/public/h5/pcguide.html +241 -0
  26. package/data/uni-app-x-docs/.vuepress/public/h5/touch-emulator.js +363 -0
  27. package/data/uni-app-x-docs/.vuepress/public/js/miku.js +10 -0
  28. package/data/uni-app-x-docs/.vuepress/public/miku-delivery-1.2.1.js +7 -0
  29. package/data/uni-app-x-docs/.vuepress/public/miku-delivery-sw-1.2.1.js +7 -0
  30. package/data/uni-app-x-docs/.vuepress/public/pc.html +157 -0
  31. package/data/uni-app-x-docs/.vuepress/public/static/web-view-forum.html +119 -0
  32. package/data/uni-app-x-docs/.vuepress/public/static/web-view.html +119 -0
  33. package/data/uni-app-x-docs/.vuepress/public/svg/uni-open-bridge.svg +1 -0
  34. package/data/uni-app-x-docs/.vuepress/utils/code.js +61 -0
  35. package/data/uni-app-x-docs/.vuepress/utils/cssJson.json +1 -0
  36. package/data/uni-app-x-docs/.vuepress/utils/customTypeJson.json +1 -0
  37. package/data/uni-app-x-docs/.vuepress/utils/example-mapping.json +39 -0
  38. package/data/uni-app-x-docs/.vuepress/utils/example.js +107 -0
  39. package/data/uni-app-x-docs/.vuepress/utils/index.js +20 -0
  40. package/data/uni-app-x-docs/.vuepress/utils/maniFestJson.json +1 -0
  41. package/data/uni-app-x-docs/.vuepress/utils/pageInstanceJson.json +1 -0
  42. package/data/uni-app-x-docs/.vuepress/utils/pagesJson.json +1 -0
  43. package/data/uni-app-x-docs/.vuepress/utils/specialStringJson.json +1 -0
  44. package/data/uni-app-x-docs/.vuepress/utils/utsApiJson.json +1 -0
  45. package/data/uni-app-x-docs/.vuepress/utils/utsComJson.json +1 -0
  46. package/data/uni-app-x-docs/.vuepress/utils/utsDiffTSJson.json +1 -0
  47. package/data/uni-app-x-docs/.vuepress/utils/utsJson.json +1 -0
  48. package/data/uni-app-x-docs/.vuepress/utils/utsUnicloudApiJson.json +1 -0
  49. package/data/uni-app-x-docs/.vuepress/utils/vueJson.json +1 -0
  50. package/data/uni-app-x-docs/404.md +2 -0
  51. package/data/uni-app-x-docs/_sidebar.md +135 -0
  52. package/data/uni-app-x-docs/adapt.md +169 -0
  53. package/data/uni-app-x-docs/ai/NOTE.md +7 -0
  54. package/data/uni-app-x-docs/api/README.md +105 -0
  55. package/data/uni-app-x-docs/api/_sidebar.md +165 -0
  56. package/data/uni-app-x-docs/api/accelerometer.md +72 -0
  57. package/data/uni-app-x-docs/api/action-sheet.md +40 -0
  58. package/data/uni-app-x-docs/api/animation-frame.md +57 -0
  59. package/data/uni-app-x-docs/api/app-route.md +323 -0
  60. package/data/uni-app-x-docs/api/authentication.md +62 -0
  61. package/data/uni-app-x-docs/api/base64.md +33 -0
  62. package/data/uni-app-x-docs/api/bio-auth.md +5 -0
  63. package/data/uni-app-x-docs/api/calendar.md +40 -0
  64. package/data/uni-app-x-docs/api/canvas-get-image-data.md +5 -0
  65. package/data/uni-app-x-docs/api/canvas-put-image-data.md +5 -0
  66. package/data/uni-app-x-docs/api/canvas-to-temp-file-path.md +17 -0
  67. package/data/uni-app-x-docs/api/canvasrenderingcontext2d.md +673 -0
  68. package/data/uni-app-x-docs/api/capture-screen.md +55 -0
  69. package/data/uni-app-x-docs/api/capturescreen.md +5 -0
  70. package/data/uni-app-x-docs/api/choose-file.md +27 -0
  71. package/data/uni-app-x-docs/api/choose-image.md +40 -0
  72. package/data/uni-app-x-docs/api/choose-location.md +304 -0
  73. package/data/uni-app-x-docs/api/choose-media.md +29 -0
  74. package/data/uni-app-x-docs/api/choose-video.md +31 -0
  75. package/data/uni-app-x-docs/api/clipboard.md +44 -0
  76. package/data/uni-app-x-docs/api/compass.md +53 -0
  77. package/data/uni-app-x-docs/api/compress-image.md +25 -0
  78. package/data/uni-app-x-docs/api/compress-video.md +21 -0
  79. package/data/uni-app-x-docs/api/connect-event-source.md +34 -0
  80. package/data/uni-app-x-docs/api/contact.md +37 -0
  81. package/data/uni-app-x-docs/api/create-camera-context.md +27 -0
  82. package/data/uni-app-x-docs/api/create-canvas-context-async.md +36 -0
  83. package/data/uni-app-x-docs/api/create-editor-context-async.md +23 -0
  84. package/data/uni-app-x-docs/api/create-inner-audio-context.md +67 -0
  85. package/data/uni-app-x-docs/api/create-intersection-observer.md +17 -0
  86. package/data/uni-app-x-docs/api/create-interstitial-ad.md +43 -0
  87. package/data/uni-app-x-docs/api/create-live-player-context.md +26 -0
  88. package/data/uni-app-x-docs/api/create-live-pusher-context.md +26 -0
  89. package/data/uni-app-x-docs/api/create-map-context.md +13 -0
  90. package/data/uni-app-x-docs/api/create-request-permission-listener.md +37 -0
  91. package/data/uni-app-x-docs/api/create-rewarded-video-ad.md +58 -0
  92. package/data/uni-app-x-docs/api/create-selector-query.md +161 -0
  93. package/data/uni-app-x-docs/api/create-video-context.md +46 -0
  94. package/data/uni-app-x-docs/api/create-webview-context.md +66 -0
  95. package/data/uni-app-x-docs/api/create-worker.md +293 -0
  96. package/data/uni-app-x-docs/api/dialog-page.md +113 -0
  97. package/data/uni-app-x-docs/api/dom/README.md +520 -0
  98. package/data/uni-app-x-docs/api/dom/cssstyledeclaration.md +515 -0
  99. package/data/uni-app-x-docs/api/dom/domrect.md +11 -0
  100. package/data/uni-app-x-docs/api/dom/drawablecontext.md +212 -0
  101. package/data/uni-app-x-docs/api/dom/element.md +5 -0
  102. package/data/uni-app-x-docs/api/dom/unicanvaselement.md +101 -0
  103. package/data/uni-app-x-docs/api/dom/unielement.md +608 -0
  104. package/data/uni-app-x-docs/api/dom/uniimageelement.md +25 -0
  105. package/data/uni-app-x-docs/api/dom/uniinputelement.md +11 -0
  106. package/data/uni-app-x-docs/api/dom/uninativeviewelement.md +98 -0
  107. package/data/uni-app-x-docs/api/dom/uniresizeobserver.md +48 -0
  108. package/data/uni-app-x-docs/api/dom/unitextareaelement.md +11 -0
  109. package/data/uni-app-x-docs/api/dom/unitextelement.md +49 -0
  110. package/data/uni-app-x-docs/api/dom/univideoelement.md +108 -0
  111. package/data/uni-app-x-docs/api/dom/uniwebviewelement.md +97 -0
  112. package/data/uni-app-x-docs/api/download-file.md +52 -0
  113. package/data/uni-app-x-docs/api/env.md +19 -0
  114. package/data/uni-app-x-docs/api/event-bus.md +81 -0
  115. package/data/uni-app-x-docs/api/exit.md +63 -0
  116. package/data/uni-app-x-docs/api/ext.md +61 -0
  117. package/data/uni-app-x-docs/api/facial-recognition-meta-info.md +47 -0
  118. package/data/uni-app-x-docs/api/facial-recognition-verify.md +5 -0
  119. package/data/uni-app-x-docs/api/file-system-spec.md +224 -0
  120. package/data/uni-app-x-docs/api/get-accessibility-info.md +23 -0
  121. package/data/uni-app-x-docs/api/get-app-authorize-setting.md +29 -0
  122. package/data/uni-app-x-docs/api/get-app-base-info.md +32 -0
  123. package/data/uni-app-x-docs/api/get-app.md +28 -0
  124. package/data/uni-app-x-docs/api/get-background-audio-manager.md +54 -0
  125. package/data/uni-app-x-docs/api/get-battery-info.md +31 -0
  126. package/data/uni-app-x-docs/api/get-current-pages.md +39 -0
  127. package/data/uni-app-x-docs/api/get-device-info.md +35 -0
  128. package/data/uni-app-x-docs/api/get-element-by-id.md +55 -0
  129. package/data/uni-app-x-docs/api/get-element.md +5 -0
  130. package/data/uni-app-x-docs/api/get-file-system-manager.md +62 -0
  131. package/data/uni-app-x-docs/api/get-image-info.md +22 -0
  132. package/data/uni-app-x-docs/api/get-launch-options-sync.md +5 -0
  133. package/data/uni-app-x-docs/api/get-location.md +210 -0
  134. package/data/uni-app-x-docs/api/get-network-type.md +23 -0
  135. package/data/uni-app-x-docs/api/get-performance.md +17 -0
  136. package/data/uni-app-x-docs/api/get-provider.md +5 -0
  137. package/data/uni-app-x-docs/api/get-recorder-manager.md +51 -0
  138. package/data/uni-app-x-docs/api/get-system-info.md +100 -0
  139. package/data/uni-app-x-docs/api/get-system-setting.md +24 -0
  140. package/data/uni-app-x-docs/api/get-univerify-manager.md +306 -0
  141. package/data/uni-app-x-docs/api/get-video-info.md +21 -0
  142. package/data/uni-app-x-docs/api/get-window-info.md +55 -0
  143. package/data/uni-app-x-docs/api/gyroscope.md +80 -0
  144. package/data/uni-app-x-docs/api/image.md +32 -0
  145. package/data/uni-app-x-docs/api/install-apk.md +26 -0
  146. package/data/uni-app-x-docs/api/interceptor.md +35 -0
  147. package/data/uni-app-x-docs/api/is-simulator.md +29 -0
  148. package/data/uni-app-x-docs/api/keyboard.md +55 -0
  149. package/data/uni-app-x-docs/api/launch.md +43 -0
  150. package/data/uni-app-x-docs/api/load-font-face.md +46 -0
  151. package/data/uni-app-x-docs/api/loading.md +61 -0
  152. package/data/uni-app-x-docs/api/locale.md +43 -0
  153. package/data/uni-app-x-docs/api/location-change.md +123 -0
  154. package/data/uni-app-x-docs/api/make-phone-call.md +25 -0
  155. package/data/uni-app-x-docs/api/memory.md +29 -0
  156. package/data/uni-app-x-docs/api/modal.md +50 -0
  157. package/data/uni-app-x-docs/api/navigator-bar-loading.md +40 -0
  158. package/data/uni-app-x-docs/api/navigator.md +89 -0
  159. package/data/uni-app-x-docs/api/network-status-change.md +41 -0
  160. package/data/uni-app-x-docs/api/network-summarize.md +40 -0
  161. package/data/uni-app-x-docs/api/nodes-info.md +5 -0
  162. package/data/uni-app-x-docs/api/on-tab-bar-mid-button-tap.md +20 -0
  163. package/data/uni-app-x-docs/api/open-app-authorize-setting.md +23 -0
  164. package/data/uni-app-x-docs/api/open-document.md +21 -0
  165. package/data/uni-app-x-docs/api/open-location.md +22 -0
  166. package/data/uni-app-x-docs/api/page-scroll-to.md +57 -0
  167. package/data/uni-app-x-docs/api/path2d.md +160 -0
  168. package/data/uni-app-x-docs/api/preview-image.md +44 -0
  169. package/data/uni-app-x-docs/api/privacy.md +84 -0
  170. package/data/uni-app-x-docs/api/provider.md +123 -0
  171. package/data/uni-app-x-docs/api/pull-down-refresh.md +46 -0
  172. package/data/uni-app-x-docs/api/push.md +1 -0
  173. package/data/uni-app-x-docs/api/report.md +44 -0
  174. package/data/uni-app-x-docs/api/request-merchant-transfer.md +31 -0
  175. package/data/uni-app-x-docs/api/request-payment.md +212 -0
  176. package/data/uni-app-x-docs/api/request-system-permission.md +21 -0
  177. package/data/uni-app-x-docs/api/request.md +72 -0
  178. package/data/uni-app-x-docs/api/rpx2px.md +19 -0
  179. package/data/uni-app-x-docs/api/save-image-to-photos-album.md +19 -0
  180. package/data/uni-app-x-docs/api/save-video-to-photos-album.md +17 -0
  181. package/data/uni-app-x-docs/api/scan-code.md +39 -0
  182. package/data/uni-app-x-docs/api/screen-brightness.md +53 -0
  183. package/data/uni-app-x-docs/api/set-navigation-bar-color.md +27 -0
  184. package/data/uni-app-x-docs/api/set-navigation-bar-title.md +22 -0
  185. package/data/uni-app-x-docs/api/set-tab-bar.md +121 -0
  186. package/data/uni-app-x-docs/api/set-tabbar.md +5 -0
  187. package/data/uni-app-x-docs/api/share-with-system.md +27 -0
  188. package/data/uni-app-x-docs/api/share.md +128 -0
  189. package/data/uni-app-x-docs/api/show-action-sheet.md +5 -0
  190. package/data/uni-app-x-docs/api/show-loading.md +5 -0
  191. package/data/uni-app-x-docs/api/show-modal.md +5 -0
  192. package/data/uni-app-x-docs/api/show-toast.md +5 -0
  193. package/data/uni-app-x-docs/api/sign-in.md +141 -0
  194. package/data/uni-app-x-docs/api/storage.md +347 -0
  195. package/data/uni-app-x-docs/api/theme-change.md +477 -0
  196. package/data/uni-app-x-docs/api/theme.md +5 -0
  197. package/data/uni-app-x-docs/api/toast.md +62 -0
  198. package/data/uni-app-x-docs/api/uni-push.md +251 -0
  199. package/data/uni-app-x-docs/api/unicloud/README.md +25 -0
  200. package/data/uni-app-x-docs/api/unicloud/database.md +27 -0
  201. package/data/uni-app-x-docs/api/unicloud/function.md +58 -0
  202. package/data/uni-app-x-docs/api/unicloud/object.md +75 -0
  203. package/data/uni-app-x-docs/api/unicloud/sse-channel.md +103 -0
  204. package/data/uni-app-x-docs/api/unicloud/storage.md +46 -0
  205. package/data/uni-app-x-docs/api/unicloud/utils.md +71 -0
  206. package/data/uni-app-x-docs/api/unipage.md +389 -0
  207. package/data/uni-app-x-docs/api/upload-file.md +40 -0
  208. package/data/uni-app-x-docs/api/vibrate.md +37 -0
  209. package/data/uni-app-x-docs/api/virtual-payment.md +228 -0
  210. package/data/uni-app-x-docs/api/websocket-global.md +5 -0
  211. package/data/uni-app-x-docs/api/websocket.md +116 -0
  212. package/data/uni-app-x-docs/api/wide-screen-adaptation.md +197 -0
  213. package/data/uni-app-x-docs/api/wifi.md +135 -0
  214. package/data/uni-app-x-docs/api/window.md +37 -0
  215. package/data/uni-app-x-docs/app-harmony/README.md +75 -0
  216. package/data/uni-app-x-docs/app-harmony/harmony-vapor.md +5 -0
  217. package/data/uni-app-x-docs/app-vapor.md +599 -0
  218. package/data/uni-app-x-docs/benchmark/vapor-benchmark-android.md +488 -0
  219. package/data/uni-app-x-docs/benchmark/vapor-benchmark-harmony.md +312 -0
  220. package/data/uni-app-x-docs/benchmark/vapor-benchmark-ios.md +375 -0
  221. package/data/uni-app-x-docs/collocation/_sidebar.md +15 -0
  222. package/data/uni-app-x-docs/collocation/app.md +263 -0
  223. package/data/uni-app-x-docs/collocation/manifest-android.md +1321 -0
  224. package/data/uni-app-x-docs/collocation/manifest-harmony.md +152 -0
  225. package/data/uni-app-x-docs/collocation/manifest-ios.md +731 -0
  226. package/data/uni-app-x-docs/collocation/manifest-modules.md +521 -0
  227. package/data/uni-app-x-docs/collocation/manifest-splashscreen.md +232 -0
  228. package/data/uni-app-x-docs/collocation/manifest.md +591 -0
  229. package/data/uni-app-x-docs/collocation/pagesjson.md +462 -0
  230. package/data/uni-app-x-docs/collocation/themejson.md +177 -0
  231. package/data/uni-app-x-docs/compiler/README.md +125 -0
  232. package/data/uni-app-x-docs/compiler/_sidebar.md +4 -0
  233. package/data/uni-app-x-docs/component/README.md +228 -0
  234. package/data/uni-app-x-docs/component/_sidebar.md +118 -0
  235. package/data/uni-app-x-docs/component/ad-custom.md +19 -0
  236. package/data/uni-app-x-docs/component/ad.md +45 -0
  237. package/data/uni-app-x-docs/component/animation-view.md +19 -0
  238. package/data/uni-app-x-docs/component/aria-component.md +19 -0
  239. package/data/uni-app-x-docs/component/audio.md +7 -0
  240. package/data/uni-app-x-docs/component/block.md +21 -0
  241. package/data/uni-app-x-docs/component/button.md +105 -0
  242. package/data/uni-app-x-docs/component/camera.md +54 -0
  243. package/data/uni-app-x-docs/component/canvas.md +163 -0
  244. package/data/uni-app-x-docs/component/channel-live.md +19 -0
  245. package/data/uni-app-x-docs/component/channel-video.md +19 -0
  246. package/data/uni-app-x-docs/component/checkbox-group.md +21 -0
  247. package/data/uni-app-x-docs/component/checkbox.md +27 -0
  248. package/data/uni-app-x-docs/component/common.md +304 -0
  249. package/data/uni-app-x-docs/component/cover-image.md +25 -0
  250. package/data/uni-app-x-docs/component/cover-view.md +25 -0
  251. package/data/uni-app-x-docs/component/custom-tab-bar.md +19 -0
  252. package/data/uni-app-x-docs/component/double-tap-gesture-handler.md +19 -0
  253. package/data/uni-app-x-docs/component/draggable-sheet.md +19 -0
  254. package/data/uni-app-x-docs/component/editor.md +33 -0
  255. package/data/uni-app-x-docs/component/flow-item.md +5 -0
  256. package/data/uni-app-x-docs/component/force-press-gesture-handler.md +19 -0
  257. package/data/uni-app-x-docs/component/form.md +108 -0
  258. package/data/uni-app-x-docs/component/functional-page-navigator.md +19 -0
  259. package/data/uni-app-x-docs/component/glass-effect-view.md +32 -0
  260. package/data/uni-app-x-docs/component/grid-builder.md +19 -0
  261. package/data/uni-app-x-docs/component/grid-view.md +19 -0
  262. package/data/uni-app-x-docs/component/horizontal-drag-gesture-handler.md +19 -0
  263. package/data/uni-app-x-docs/component/icon.md +19 -0
  264. package/data/uni-app-x-docs/component/image.md +79 -0
  265. package/data/uni-app-x-docs/component/input.md +121 -0
  266. package/data/uni-app-x-docs/component/keyboard-accessory.md +19 -0
  267. package/data/uni-app-x-docs/component/label.md +21 -0
  268. package/data/uni-app-x-docs/component/list-builder.md +19 -0
  269. package/data/uni-app-x-docs/component/list-item.md +1 -0
  270. package/data/uni-app-x-docs/component/list-view.md +191 -0
  271. package/data/uni-app-x-docs/component/live-player.md +29 -0
  272. package/data/uni-app-x-docs/component/live-pusher.md +31 -0
  273. package/data/uni-app-x-docs/component/loading.md +31 -0
  274. package/data/uni-app-x-docs/component/long-press-gesture-handler.md +19 -0
  275. package/data/uni-app-x-docs/component/map.md +114 -0
  276. package/data/uni-app-x-docs/component/match-media.md +21 -0
  277. package/data/uni-app-x-docs/component/movable-area.md +27 -0
  278. package/data/uni-app-x-docs/component/movable-view.md +27 -0
  279. package/data/uni-app-x-docs/component/native-component.md +19 -0
  280. package/data/uni-app-x-docs/component/native-view.md +210 -0
  281. package/data/uni-app-x-docs/component/navigation-bar.md +19 -0
  282. package/data/uni-app-x-docs/component/navigator.md +22 -0
  283. package/data/uni-app-x-docs/component/nested-scroll-body.md +32 -0
  284. package/data/uni-app-x-docs/component/nested-scroll-header.md +32 -0
  285. package/data/uni-app-x-docs/component/nested-scroll.md +8 -0
  286. package/data/uni-app-x-docs/component/official-account.md +19 -0
  287. package/data/uni-app-x-docs/component/open-container.md +19 -0
  288. package/data/uni-app-x-docs/component/page-container.md +37 -0
  289. package/data/uni-app-x-docs/component/page-meta.md +19 -0
  290. package/data/uni-app-x-docs/component/pan-gesture-handler.md +19 -0
  291. package/data/uni-app-x-docs/component/picker-view-column.md +5 -0
  292. package/data/uni-app-x-docs/component/picker-view.md +48 -0
  293. package/data/uni-app-x-docs/component/picker.md +29 -0
  294. package/data/uni-app-x-docs/component/progress.md +19 -0
  295. package/data/uni-app-x-docs/component/radio-group.md +21 -0
  296. package/data/uni-app-x-docs/component/radio.md +27 -0
  297. package/data/uni-app-x-docs/component/rich-text.md +108 -0
  298. package/data/uni-app-x-docs/component/root-portal.md +19 -0
  299. package/data/uni-app-x-docs/component/scale-gesture-handler.md +19 -0
  300. package/data/uni-app-x-docs/component/scroll-view.md +213 -0
  301. package/data/uni-app-x-docs/component/share-element.md +84 -0
  302. package/data/uni-app-x-docs/component/slider.md +44 -0
  303. package/data/uni-app-x-docs/component/snapshot.md +19 -0
  304. package/data/uni-app-x-docs/component/span.md +19 -0
  305. package/data/uni-app-x-docs/component/sticky-header.md +50 -0
  306. package/data/uni-app-x-docs/component/sticky-section.md +54 -0
  307. package/data/uni-app-x-docs/component/sticky.md +8 -0
  308. package/data/uni-app-x-docs/component/store-home.md +19 -0
  309. package/data/uni-app-x-docs/component/store-product.md +19 -0
  310. package/data/uni-app-x-docs/component/swiper-item.md +5 -0
  311. package/data/uni-app-x-docs/component/swiper.md +94 -0
  312. package/data/uni-app-x-docs/component/switch.md +28 -0
  313. package/data/uni-app-x-docs/component/tap-gesture-handler.md +19 -0
  314. package/data/uni-app-x-docs/component/text.md +242 -0
  315. package/data/uni-app-x-docs/component/textarea.md +90 -0
  316. package/data/uni-app-x-docs/component/uni-ui-x/README.md +1 -0
  317. package/data/uni-app-x-docs/component/uni-ui-x/uni-badge-view.md +25 -0
  318. package/data/uni-app-x-docs/component/uni-ui-x/uni-collapse-item.md +5 -0
  319. package/data/uni-app-x-docs/component/uni-ui-x/uni-collapse.md +48 -0
  320. package/data/uni-app-x-docs/component/uni-ui-x/uni-drag-cell.md +25 -0
  321. package/data/uni-app-x-docs/component/uni-ui-x/uni-fab-button.md +25 -0
  322. package/data/uni-app-x-docs/component/uni-ui-x/uni-index-bar.md +25 -0
  323. package/data/uni-app-x-docs/component/uni-ui-x/uni-link.md +25 -0
  324. package/data/uni-app-x-docs/component/uni-ui-x/uni-nav-bar.md +25 -0
  325. package/data/uni-app-x-docs/component/uni-ui-x/uni-number-box.md +25 -0
  326. package/data/uni-app-x-docs/component/uni-ui-x/uni-rate.md +25 -0
  327. package/data/uni-app-x-docs/component/uni-ui-x/uni-refresh-box.md +25 -0
  328. package/data/uni-app-x-docs/component/uni-ui-x/uni-tab-bar.md +5 -0
  329. package/data/uni-app-x-docs/component/uni-ui-x/uni-tab-content.md +5 -0
  330. package/data/uni-app-x-docs/component/uni-ui-x/uni-tab-item.md +5 -0
  331. package/data/uni-app-x-docs/component/uni-ui-x/uni-tab-midbutton.md +5 -0
  332. package/data/uni-app-x-docs/component/uni-ui-x/uni-tab.md +111 -0
  333. package/data/uni-app-x-docs/component/uni-ui-x/uni-time-format.md +25 -0
  334. package/data/uni-app-x-docs/component/unicloud-db.md +19 -0
  335. package/data/uni-app-x-docs/component/vertical-drag-gesture-handler.md +19 -0
  336. package/data/uni-app-x-docs/component/video.md +135 -0
  337. package/data/uni-app-x-docs/component/view.md +86 -0
  338. package/data/uni-app-x-docs/component/voip-room.md +19 -0
  339. package/data/uni-app-x-docs/component/waterflow.md +122 -0
  340. package/data/uni-app-x-docs/component/web-view.md +160 -0
  341. package/data/uni-app-x-docs/css/README.md +274 -0
  342. package/data/uni-app-x-docs/css/_sidebar.md +104 -0
  343. package/data/uni-app-x-docs/css/align-content.md +22 -0
  344. package/data/uni-app-x-docs/css/align-items.md +20 -0
  345. package/data/uni-app-x-docs/css/align-self.md +20 -0
  346. package/data/uni-app-x-docs/css/animation-composition.md +18 -0
  347. package/data/uni-app-x-docs/css/animation-delay.md +18 -0
  348. package/data/uni-app-x-docs/css/animation-direction.md +18 -0
  349. package/data/uni-app-x-docs/css/animation-duration.md +18 -0
  350. package/data/uni-app-x-docs/css/animation-fill-mode.md +18 -0
  351. package/data/uni-app-x-docs/css/animation-iteration-count.md +18 -0
  352. package/data/uni-app-x-docs/css/animation-name.md +18 -0
  353. package/data/uni-app-x-docs/css/animation-play-state.md +18 -0
  354. package/data/uni-app-x-docs/css/animation-range-end.md +18 -0
  355. package/data/uni-app-x-docs/css/animation-range-start.md +18 -0
  356. package/data/uni-app-x-docs/css/animation-range.md +18 -0
  357. package/data/uni-app-x-docs/css/animation-timeline.md +18 -0
  358. package/data/uni-app-x-docs/css/animation-timing-function.md +18 -0
  359. package/data/uni-app-x-docs/css/animation.md +18 -0
  360. package/data/uni-app-x-docs/css/backdrop-filter.md +21 -0
  361. package/data/uni-app-x-docs/css/background-clip.md +20 -0
  362. package/data/uni-app-x-docs/css/background-color.md +25 -0
  363. package/data/uni-app-x-docs/css/background-image.md +48 -0
  364. package/data/uni-app-x-docs/css/background.md +20 -0
  365. package/data/uni-app-x-docs/css/border-bottom-color.md +20 -0
  366. package/data/uni-app-x-docs/css/border-bottom-left-radius.md +23 -0
  367. package/data/uni-app-x-docs/css/border-bottom-right-radius.md +23 -0
  368. package/data/uni-app-x-docs/css/border-bottom-style.md +20 -0
  369. package/data/uni-app-x-docs/css/border-bottom-width.md +27 -0
  370. package/data/uni-app-x-docs/css/border-bottom.md +20 -0
  371. package/data/uni-app-x-docs/css/border-color.md +20 -0
  372. package/data/uni-app-x-docs/css/border-left-color.md +20 -0
  373. package/data/uni-app-x-docs/css/border-left-style.md +20 -0
  374. package/data/uni-app-x-docs/css/border-left-width.md +27 -0
  375. package/data/uni-app-x-docs/css/border-left.md +20 -0
  376. package/data/uni-app-x-docs/css/border-radius.md +27 -0
  377. package/data/uni-app-x-docs/css/border-right-color.md +20 -0
  378. package/data/uni-app-x-docs/css/border-right-style.md +20 -0
  379. package/data/uni-app-x-docs/css/border-right-width.md +27 -0
  380. package/data/uni-app-x-docs/css/border-right.md +20 -0
  381. package/data/uni-app-x-docs/css/border-style.md +24 -0
  382. package/data/uni-app-x-docs/css/border-top-color.md +20 -0
  383. package/data/uni-app-x-docs/css/border-top-left-radius.md +23 -0
  384. package/data/uni-app-x-docs/css/border-top-right-radius.md +23 -0
  385. package/data/uni-app-x-docs/css/border-top-style.md +20 -0
  386. package/data/uni-app-x-docs/css/border-top-width.md +27 -0
  387. package/data/uni-app-x-docs/css/border-top.md +20 -0
  388. package/data/uni-app-x-docs/css/border-width.md +24 -0
  389. package/data/uni-app-x-docs/css/border.md +23 -0
  390. package/data/uni-app-x-docs/css/bottom.md +20 -0
  391. package/data/uni-app-x-docs/css/box-shadow.md +26 -0
  392. package/data/uni-app-x-docs/css/box-sizing.md +20 -0
  393. package/data/uni-app-x-docs/css/color.md +27 -0
  394. package/data/uni-app-x-docs/css/common/at-rules.md +293 -0
  395. package/data/uni-app-x-docs/css/common/color.md +9 -0
  396. package/data/uni-app-x-docs/css/common/function.md +161 -0
  397. package/data/uni-app-x-docs/css/common/length.md +89 -0
  398. package/data/uni-app-x-docs/css/common/selector.md +48 -0
  399. package/data/uni-app-x-docs/css/common/style-isolation.md +258 -0
  400. package/data/uni-app-x-docs/css/common/variable.md +1 -0
  401. package/data/uni-app-x-docs/css/css_diff_web.md +802 -0
  402. package/data/uni-app-x-docs/css/direction.md +18 -0
  403. package/data/uni-app-x-docs/css/display.md +23 -0
  404. package/data/uni-app-x-docs/css/flex-basis.md +20 -0
  405. package/data/uni-app-x-docs/css/flex-direction.md +20 -0
  406. package/data/uni-app-x-docs/css/flex-flow.md +20 -0
  407. package/data/uni-app-x-docs/css/flex-grow.md +20 -0
  408. package/data/uni-app-x-docs/css/flex-shrink.md +20 -0
  409. package/data/uni-app-x-docs/css/flex-wrap.md +20 -0
  410. package/data/uni-app-x-docs/css/flex.md +20 -0
  411. package/data/uni-app-x-docs/css/font-family.md +50 -0
  412. package/data/uni-app-x-docs/css/font-size.md +51 -0
  413. package/data/uni-app-x-docs/css/font-style.md +23 -0
  414. package/data/uni-app-x-docs/css/font-weight.md +24 -0
  415. package/data/uni-app-x-docs/css/height.md +23 -0
  416. package/data/uni-app-x-docs/css/justify-content.md +20 -0
  417. package/data/uni-app-x-docs/css/left.md +20 -0
  418. package/data/uni-app-x-docs/css/letter-spacing.md +20 -0
  419. package/data/uni-app-x-docs/css/line-height.md +37 -0
  420. package/data/uni-app-x-docs/css/lines.md +23 -0
  421. package/data/uni-app-x-docs/css/margin-bottom.md +25 -0
  422. package/data/uni-app-x-docs/css/margin-left.md +25 -0
  423. package/data/uni-app-x-docs/css/margin-right.md +25 -0
  424. package/data/uni-app-x-docs/css/margin-top.md +25 -0
  425. package/data/uni-app-x-docs/css/margin.md +33 -0
  426. package/data/uni-app-x-docs/css/max-height.md +20 -0
  427. package/data/uni-app-x-docs/css/max-width.md +20 -0
  428. package/data/uni-app-x-docs/css/min-height.md +27 -0
  429. package/data/uni-app-x-docs/css/min-width.md +20 -0
  430. package/data/uni-app-x-docs/css/opacity.md +20 -0
  431. package/data/uni-app-x-docs/css/overflow.md +28 -0
  432. package/data/uni-app-x-docs/css/padding-bottom.md +23 -0
  433. package/data/uni-app-x-docs/css/padding-left.md +23 -0
  434. package/data/uni-app-x-docs/css/padding-right.md +23 -0
  435. package/data/uni-app-x-docs/css/padding-top.md +23 -0
  436. package/data/uni-app-x-docs/css/padding.md +23 -0
  437. package/data/uni-app-x-docs/css/pointer-events.md +26 -0
  438. package/data/uni-app-x-docs/css/position.md +50 -0
  439. package/data/uni-app-x-docs/css/right.md +20 -0
  440. package/data/uni-app-x-docs/css/text-align.md +23 -0
  441. package/data/uni-app-x-docs/css/text-decoration-color.md +25 -0
  442. package/data/uni-app-x-docs/css/text-decoration-line.md +24 -0
  443. package/data/uni-app-x-docs/css/text-decoration-style.md +23 -0
  444. package/data/uni-app-x-docs/css/text-decoration-thickness.md +23 -0
  445. package/data/uni-app-x-docs/css/text-decoration.md +24 -0
  446. package/data/uni-app-x-docs/css/text-overflow.md +24 -0
  447. package/data/uni-app-x-docs/css/text-shadow.md +22 -0
  448. package/data/uni-app-x-docs/css/top.md +20 -0
  449. package/data/uni-app-x-docs/css/transform-origin.md +20 -0
  450. package/data/uni-app-x-docs/css/transform.md +32 -0
  451. package/data/uni-app-x-docs/css/transition-delay.md +27 -0
  452. package/data/uni-app-x-docs/css/transition-duration.md +27 -0
  453. package/data/uni-app-x-docs/css/transition-property.md +23 -0
  454. package/data/uni-app-x-docs/css/transition-timing-function.md +23 -0
  455. package/data/uni-app-x-docs/css/transition.md +43 -0
  456. package/data/uni-app-x-docs/css/visibility.md +26 -0
  457. package/data/uni-app-x-docs/css/white-space.md +49 -0
  458. package/data/uni-app-x-docs/css/width.md +23 -0
  459. package/data/uni-app-x-docs/css/z-index.md +127 -0
  460. package/data/uni-app-x-docs/debug/android-inspector.md +55 -0
  461. package/data/uni-app-x-docs/i18n.md +379 -0
  462. package/data/uni-app-x-docs/mp/README.md +159 -0
  463. package/data/uni-app-x-docs/native/README.md +67 -0
  464. package/data/uni-app-x-docs/native/debug/android.md +126 -0
  465. package/data/uni-app-x-docs/native/debug/harmony.md +119 -0
  466. package/data/uni-app-x-docs/native/debug/ios.md +92 -0
  467. package/data/uni-app-x-docs/native/download/android.md +45 -0
  468. package/data/uni-app-x-docs/native/download/ios.md +30 -0
  469. package/data/uni-app-x-docs/native/modules/android/others.md +1441 -0
  470. package/data/uni-app-x-docs/native/modules/android/uni-ad.md +104 -0
  471. package/data/uni-app-x-docs/native/modules/android/uni-facialRecognitionVerify.md +74 -0
  472. package/data/uni-app-x-docs/native/modules/android/uni-getLocation.md +131 -0
  473. package/data/uni-app-x-docs/native/modules/android/uni-map-tencent.md +101 -0
  474. package/data/uni-app-x-docs/native/modules/android/uni-oauth.md +61 -0
  475. package/data/uni-app-x-docs/native/modules/android/uni-payment.md +120 -0
  476. package/data/uni-app-x-docs/native/modules/android/uni-push.md +229 -0
  477. package/data/uni-app-x-docs/native/modules/android/uni-share.md +61 -0
  478. package/data/uni-app-x-docs/native/modules/android/uni-verify.md +105 -0
  479. package/data/uni-app-x-docs/native/modules/android/uni-video.md +135 -0
  480. package/data/uni-app-x-docs/native/modules/harmony/facialVerify.md +47 -0
  481. package/data/uni-app-x-docs/native/modules/harmony/location.md +43 -0
  482. package/data/uni-app-x-docs/native/modules/harmony/map.md +64 -0
  483. package/data/uni-app-x-docs/native/modules/harmony/modules.md +23 -0
  484. package/data/uni-app-x-docs/native/modules/harmony/oauth.md +47 -0
  485. package/data/uni-app-x-docs/native/modules/harmony/pay.md +87 -0
  486. package/data/uni-app-x-docs/native/modules/harmony/push.md +74 -0
  487. package/data/uni-app-x-docs/native/modules/harmony/verify.md +45 -0
  488. package/data/uni-app-x-docs/native/modules/ios/modules.md +962 -0
  489. package/data/uni-app-x-docs/native/permission/android_permission_adapter.md +63 -0
  490. package/data/uni-app-x-docs/native/use/android.md +541 -0
  491. package/data/uni-app-x-docs/native/use/androidcomm.md +164 -0
  492. package/data/uni-app-x-docs/native/use/androiduts.md +398 -0
  493. package/data/uni-app-x-docs/native/use/harmony.md +105 -0
  494. package/data/uni-app-x-docs/native/use/harmonyapi.md +205 -0
  495. package/data/uni-app-x-docs/native/use/harmonyuts.md +62 -0
  496. package/data/uni-app-x-docs/native/use/ios.md +96 -0
  497. package/data/uni-app-x-docs/native/use/iosapi.md +290 -0
  498. package/data/uni-app-x-docs/native/use/iosuts.md +89 -0
  499. package/data/uni-app-x-docs/page.md +501 -0
  500. package/data/uni-app-x-docs/performance.md +181 -0
  501. package/data/uni-app-x-docs/plugin/NOTE.md +7 -0
  502. package/data/uni-app-x-docs/project.md +154 -0
  503. package/data/uni-app-x-docs/readme.md +401 -0
  504. package/data/uni-app-x-docs/release-note-alpha.md +2219 -0
  505. package/data/uni-app-x-docs/release.md +1961 -0
  506. package/data/uni-app-x-docs/sample.md +157 -0
  507. package/data/uni-app-x-docs/select.md +365 -0
  508. package/data/uni-app-x-docs/static/4050-hello-flatten-optimized-device1-r1.png +0 -0
  509. package/data/uni-app-x-docs/static/calendar.jpg +0 -0
  510. package/data/uni-app-x-docs/static/go-to-definition.png +0 -0
  511. package/data/uni-app-x-docs/static/hxconsolepageperformance.png +0 -0
  512. package/data/uni-app-x-docs/static/json2type.png +0 -0
  513. package/data/uni-app-x-docs/static/newproject.png +0 -0
  514. package/data/uni-app-x-docs/static/playground.jpg +0 -0
  515. package/data/uni-app-x-docs/static/project-icon.png +0 -0
  516. package/data/uni-app-x-docs/static/uaxding.png +0 -0
  517. package/data/uni-app-x-docs/static/view-API-type-info.png +0 -0
  518. package/data/uni-app-x-docs/tutorial/android-16kb.md +96 -0
  519. package/data/uni-app-x-docs/tutorial/android-memoryleak.md +553 -0
  520. package/data/uni-app-x-docs/tutorial/app-env.md +84 -0
  521. package/data/uni-app-x-docs/tutorial/app-market.md +58 -0
  522. package/data/uni-app-x-docs/tutorial/app-package.md +196 -0
  523. package/data/uni-app-x-docs/tutorial/app-playground.md +188 -0
  524. package/data/uni-app-x-docs/tutorial/bug_repair.md +40 -0
  525. package/data/uni-app-x-docs/tutorial/codegap.md +291 -0
  526. package/data/uni-app-x-docs/tutorial/compatibility.md +120 -0
  527. package/data/uni-app-x-docs/tutorial/compliance.md +833 -0
  528. package/data/uni-app-x-docs/tutorial/debug/devtools.md +137 -0
  529. package/data/uni-app-x-docs/tutorial/idref.md +126 -0
  530. package/data/uni-app-x-docs/tutorial/ls-plugin.md +186 -0
  531. package/data/uni-app-x-docs/tutorial/request.md +321 -0
  532. package/data/uni-app-x-docs/tutorial/rules_mcp.md +123 -0
  533. package/data/uni-app-x-docs/tutorial/stickynestlist.md +68 -0
  534. package/data/uni-app-x-docs/tutorial/store.md +162 -0
  535. package/data/uni-app-x-docs/uniapptox.md +145 -0
  536. package/data/uni-app-x-docs/uts/README.md +456 -0
  537. package/data/uni-app-x-docs/uts/_sidebar.md +57 -0
  538. package/data/uni-app-x-docs/uts/buildin-object-api/array.md +981 -0
  539. package/data/uni-app-x-docs/uts/buildin-object-api/arraybuffer.md +257 -0
  540. package/data/uni-app-x-docs/uts/buildin-object-api/console.md +208 -0
  541. package/data/uni-app-x-docs/uts/buildin-object-api/dataview.md +304 -0
  542. package/data/uni-app-x-docs/uts/buildin-object-api/date.md +707 -0
  543. package/data/uni-app-x-docs/uts/buildin-object-api/error.md +31 -0
  544. package/data/uni-app-x-docs/uts/buildin-object-api/float32array.md +485 -0
  545. package/data/uni-app-x-docs/uts/buildin-object-api/float64array.md +473 -0
  546. package/data/uni-app-x-docs/uts/buildin-object-api/global.md +222 -0
  547. package/data/uni-app-x-docs/uts/buildin-object-api/int16array.md +455 -0
  548. package/data/uni-app-x-docs/uts/buildin-object-api/int32array.md +483 -0
  549. package/data/uni-app-x-docs/uts/buildin-object-api/int8array.md +473 -0
  550. package/data/uni-app-x-docs/uts/buildin-object-api/json.md +236 -0
  551. package/data/uni-app-x-docs/uts/buildin-object-api/map.md +187 -0
  552. package/data/uni-app-x-docs/uts/buildin-object-api/math.md +502 -0
  553. package/data/uni-app-x-docs/uts/buildin-object-api/number.md +363 -0
  554. package/data/uni-app-x-docs/uts/buildin-object-api/promise.md +265 -0
  555. package/data/uni-app-x-docs/uts/buildin-object-api/regexp.md +263 -0
  556. package/data/uni-app-x-docs/uts/buildin-object-api/set.md +170 -0
  557. package/data/uni-app-x-docs/uts/buildin-object-api/string.md +723 -0
  558. package/data/uni-app-x-docs/uts/buildin-object-api/textdecoder.md +70 -0
  559. package/data/uni-app-x-docs/uts/buildin-object-api/textencoder.md +41 -0
  560. package/data/uni-app-x-docs/uts/buildin-object-api/timers.md +99 -0
  561. package/data/uni-app-x-docs/uts/buildin-object-api/uint16array.md +483 -0
  562. package/data/uni-app-x-docs/uts/buildin-object-api/uint32array.md +484 -0
  563. package/data/uni-app-x-docs/uts/buildin-object-api/uint8array.md +483 -0
  564. package/data/uni-app-x-docs/uts/buildin-object-api/uint8clampedarray.md +483 -0
  565. package/data/uni-app-x-docs/uts/buildin-object-api/utsjsonobject.md +361 -0
  566. package/data/uni-app-x-docs/uts/class.md +504 -0
  567. package/data/uni-app-x-docs/uts/compiler-known-issues.md +1242 -0
  568. package/data/uni-app-x-docs/uts/conditional.md +209 -0
  569. package/data/uni-app-x-docs/uts/data-type.md +2248 -0
  570. package/data/uni-app-x-docs/uts/enumerability.md +16 -0
  571. package/data/uni-app-x-docs/uts/enumerability_iterable.md +211 -0
  572. package/data/uni-app-x-docs/uts/exception.md +25 -0
  573. package/data/uni-app-x-docs/uts/function.md +359 -0
  574. package/data/uni-app-x-docs/uts/generics.md +251 -0
  575. package/data/uni-app-x-docs/uts/interface.md +37 -0
  576. package/data/uni-app-x-docs/uts/iterable.md +150 -0
  577. package/data/uni-app-x-docs/uts/keywords.md +436 -0
  578. package/data/uni-app-x-docs/uts/literal.md +252 -0
  579. package/data/uni-app-x-docs/uts/loops.md +240 -0
  580. package/data/uni-app-x-docs/uts/module.md +92 -0
  581. package/data/uni-app-x-docs/uts/object.md +156 -0
  582. package/data/uni-app-x-docs/uts/operator.md +304 -0
  583. package/data/uni-app-x-docs/uts/runtime-known-issues.md +99 -0
  584. package/data/uni-app-x-docs/uts/type-aliases.md +43 -0
  585. package/data/uni-app-x-docs/uts/type-compatibility.md +133 -0
  586. package/data/uni-app-x-docs/uts/uts-optimize.md +33 -0
  587. package/data/uni-app-x-docs/uts/uts_diff_ts.md +2292 -0
  588. package/data/uni-app-x-docs/uts/utsactivitycallback.md +1357 -0
  589. package/data/uni-app-x-docs/uts/utsandroid.md +850 -0
  590. package/data/uni-app-x-docs/uts/utsandroidhookproxy.md +17 -0
  591. package/data/uni-app-x-docs/uts/utsharmony.md +219 -0
  592. package/data/uni-app-x-docs/uts/utsios.md +305 -0
  593. package/data/uni-app-x-docs/uts/utsioshookproxy.md +148 -0
  594. package/data/uni-app-x-docs/vapor-benchmark.md +11 -0
  595. package/data/uni-app-x-docs/vue/README.md +553 -0
  596. package/data/uni-app-x-docs/vue/_sidebar.md +10 -0
  597. package/data/uni-app-x-docs/vue/advanced-api.md +138 -0
  598. package/data/uni-app-x-docs/vue/built-in.md +741 -0
  599. package/data/uni-app-x-docs/vue/component.md +704 -0
  600. package/data/uni-app-x-docs/vue/composition-api.md +792 -0
  601. package/data/uni-app-x-docs/vue/data-bind.md +163 -0
  602. package/data/uni-app-x-docs/vue/global-api.md +109 -0
  603. package/data/uni-app-x-docs/vue/modifier.md +202 -0
  604. package/data/uni-app-x-docs/vue/options-api.md +512 -0
  605. package/data/uni-app-x-docs/vue/others.md +20 -0
  606. package/data/uni-app-x-docs/web/README.md +279 -0
  607. package/data/uni-app-x-docs/web/ssr.md +290 -0
  608. package/data/uni-app-x-docs/worktile/NOTE.md +7 -0
  609. package/data/uniappx/404.md +2 -0
  610. package/data/uniappx/_sidebar.md +135 -0
  611. package/data/uniappx/adapt.md +165 -0
  612. package/data/uniappx/ai/NOTE.md +5 -0
  613. package/data/uniappx/api/README.md +98 -0
  614. package/data/uniappx/api/_sidebar.md +165 -0
  615. package/data/uniappx/api/accelerometer.md +322 -0
  616. package/data/uniappx/api/action-sheet.md +192 -0
  617. package/data/uniappx/api/animation-frame.md +125 -0
  618. package/data/uniappx/api/app-route.md +632 -0
  619. package/data/uniappx/api/authentication.md +267 -0
  620. package/data/uniappx/api/base64.md +127 -0
  621. package/data/uniappx/api/bio-auth.md +3 -0
  622. package/data/uniappx/api/calendar.md +400 -0
  623. package/data/uniappx/api/canvas-get-image-data.md +3 -0
  624. package/data/uniappx/api/canvas-put-image-data.md +3 -0
  625. package/data/uniappx/api/canvas-to-temp-file-path.md +62 -0
  626. package/data/uniappx/api/canvasrenderingcontext2d.md +128 -0
  627. package/data/uniappx/api/capture-screen.md +173 -0
  628. package/data/uniappx/api/capturescreen.md +3 -0
  629. package/data/uniappx/api/choose-file.md +174 -0
  630. package/data/uniappx/api/choose-image.md +312 -0
  631. package/data/uniappx/api/choose-location.md +412 -0
  632. package/data/uniappx/api/choose-media.md +272 -0
  633. package/data/uniappx/api/choose-video.md +165 -0
  634. package/data/uniappx/api/clipboard.md +155 -0
  635. package/data/uniappx/api/compass.md +351 -0
  636. package/data/uniappx/api/compress-image.md +147 -0
  637. package/data/uniappx/api/compress-video.md +136 -0
  638. package/data/uniappx/api/connect-event-source.md +225 -0
  639. package/data/uniappx/api/contact.md +153 -0
  640. package/data/uniappx/api/create-camera-context.md +346 -0
  641. package/data/uniappx/api/create-canvas-context-async.md +167 -0
  642. package/data/uniappx/api/create-editor-context-async.md +605 -0
  643. package/data/uniappx/api/create-inner-audio-context.md +704 -0
  644. package/data/uniappx/api/create-intersection-observer.md +195 -0
  645. package/data/uniappx/api/create-interstitial-ad.md +253 -0
  646. package/data/uniappx/api/create-live-player-context.md +185 -0
  647. package/data/uniappx/api/create-live-pusher-context.md +282 -0
  648. package/data/uniappx/api/create-map-context.md +677 -0
  649. package/data/uniappx/api/create-request-permission-listener.md +147 -0
  650. package/data/uniappx/api/create-rewarded-video-ad.md +302 -0
  651. package/data/uniappx/api/create-selector-query.md +609 -0
  652. package/data/uniappx/api/create-video-context.md +190 -0
  653. package/data/uniappx/api/create-webview-context.md +274 -0
  654. package/data/uniappx/api/create-worker.md +607 -0
  655. package/data/uniappx/api/dialog-page.md +377 -0
  656. package/data/uniappx/api/dom/README.md +319 -0
  657. package/data/uniappx/api/dom/cssstyledeclaration.md +341 -0
  658. package/data/uniappx/api/dom/domrect.md +30 -0
  659. package/data/uniappx/api/dom/drawablecontext.md +63 -0
  660. package/data/uniappx/api/dom/element.md +3 -0
  661. package/data/uniappx/api/dom/unicanvaselement.md +29 -0
  662. package/data/uniappx/api/dom/unielement.md +211 -0
  663. package/data/uniappx/api/dom/uniimageelement.md +23 -0
  664. package/data/uniappx/api/dom/uniinputelement.md +25 -0
  665. package/data/uniappx/api/dom/uninativeviewelement.md +18 -0
  666. package/data/uniappx/api/dom/uniresizeobserver.md +20 -0
  667. package/data/uniappx/api/dom/unitextareaelement.md +25 -0
  668. package/data/uniappx/api/dom/unitextelement.md +23 -0
  669. package/data/uniappx/api/dom/univideoelement.md +18 -0
  670. package/data/uniappx/api/dom/uniwebviewelement.md +18 -0
  671. package/data/uniappx/api/download-file.md +226 -0
  672. package/data/uniappx/api/env.md +101 -0
  673. package/data/uniappx/api/event-bus.md +184 -0
  674. package/data/uniappx/api/exit.md +134 -0
  675. package/data/uniappx/api/ext.md +61 -0
  676. package/data/uniappx/api/facial-recognition-meta-info.md +131 -0
  677. package/data/uniappx/api/facial-recognition-verify.md +3 -0
  678. package/data/uniappx/api/file-system-spec.md +223 -0
  679. package/data/uniappx/api/get-accessibility-info.md +113 -0
  680. package/data/uniappx/api/get-app-authorize-setting.md +276 -0
  681. package/data/uniappx/api/get-app-base-info.md +175 -0
  682. package/data/uniappx/api/get-app.md +175 -0
  683. package/data/uniappx/api/get-background-audio-manager.md +509 -0
  684. package/data/uniappx/api/get-battery-info.md +106 -0
  685. package/data/uniappx/api/get-current-pages.md +215 -0
  686. package/data/uniappx/api/get-device-info.md +188 -0
  687. package/data/uniappx/api/get-element-by-id.md +103 -0
  688. package/data/uniappx/api/get-element.md +3 -0
  689. package/data/uniappx/api/get-file-system-manager.md +2351 -0
  690. package/data/uniappx/api/get-image-info.md +143 -0
  691. package/data/uniappx/api/get-launch-options-sync.md +3 -0
  692. package/data/uniappx/api/get-location.md +362 -0
  693. package/data/uniappx/api/get-network-type.md +96 -0
  694. package/data/uniappx/api/get-performance.md +299 -0
  695. package/data/uniappx/api/get-provider.md +3 -0
  696. package/data/uniappx/api/get-recorder-manager.md +408 -0
  697. package/data/uniappx/api/get-system-info.md +527 -0
  698. package/data/uniappx/api/get-system-setting.md +133 -0
  699. package/data/uniappx/api/get-univerify-manager.md +549 -0
  700. package/data/uniappx/api/get-video-info.md +150 -0
  701. package/data/uniappx/api/get-window-info.md +163 -0
  702. package/data/uniappx/api/gyroscope.md +389 -0
  703. package/data/uniappx/api/image.md +40 -0
  704. package/data/uniappx/api/install-apk.md +93 -0
  705. package/data/uniappx/api/interceptor.md +84 -0
  706. package/data/uniappx/api/is-simulator.md +120 -0
  707. package/data/uniappx/api/keyboard.md +194 -0
  708. package/data/uniappx/api/launch.md +200 -0
  709. package/data/uniappx/api/load-font-face.md +206 -0
  710. package/data/uniappx/api/loading.md +186 -0
  711. package/data/uniappx/api/locale.md +74 -0
  712. package/data/uniappx/api/location-change.md +533 -0
  713. package/data/uniappx/api/make-phone-call.md +102 -0
  714. package/data/uniappx/api/memory.md +135 -0
  715. package/data/uniappx/api/modal.md +232 -0
  716. package/data/uniappx/api/navigator-bar-loading.md +122 -0
  717. package/data/uniappx/api/navigator.md +478 -0
  718. package/data/uniappx/api/network-status-change.md +145 -0
  719. package/data/uniappx/api/network-summarize.md +40 -0
  720. package/data/uniappx/api/nodes-info.md +3 -0
  721. package/data/uniappx/api/on-tab-bar-mid-button-tap.md +34 -0
  722. package/data/uniappx/api/open-app-authorize-setting.md +117 -0
  723. package/data/uniappx/api/open-document.md +122 -0
  724. package/data/uniappx/api/open-location.md +154 -0
  725. package/data/uniappx/api/page-scroll-to.md +170 -0
  726. package/data/uniappx/api/path2d.md +48 -0
  727. package/data/uniappx/api/preview-image.md +341 -0
  728. package/data/uniappx/api/privacy.md +232 -0
  729. package/data/uniappx/api/provider.md +329 -0
  730. package/data/uniappx/api/pull-down-refresh.md +154 -0
  731. package/data/uniappx/api/push.md +1 -0
  732. package/data/uniappx/api/report.md +150 -0
  733. package/data/uniappx/api/request-merchant-transfer.md +117 -0
  734. package/data/uniappx/api/request-payment.md +315 -0
  735. package/data/uniappx/api/request-system-permission.md +220 -0
  736. package/data/uniappx/api/request.md +517 -0
  737. package/data/uniappx/api/rpx2px.md +94 -0
  738. package/data/uniappx/api/save-image-to-photos-album.md +115 -0
  739. package/data/uniappx/api/save-video-to-photos-album.md +102 -0
  740. package/data/uniappx/api/scan-code.md +118 -0
  741. package/data/uniappx/api/screen-brightness.md +333 -0
  742. package/data/uniappx/api/set-navigation-bar-color.md +133 -0
  743. package/data/uniappx/api/set-navigation-bar-title.md +117 -0
  744. package/data/uniappx/api/set-tab-bar.md +651 -0
  745. package/data/uniappx/api/set-tabbar.md +3 -0
  746. package/data/uniappx/api/share-with-system.md +139 -0
  747. package/data/uniappx/api/share.md +325 -0
  748. package/data/uniappx/api/show-action-sheet.md +3 -0
  749. package/data/uniappx/api/show-loading.md +3 -0
  750. package/data/uniappx/api/show-modal.md +3 -0
  751. package/data/uniappx/api/show-toast.md +3 -0
  752. package/data/uniappx/api/sign-in.md +358 -0
  753. package/data/uniappx/api/storage.md +719 -0
  754. package/data/uniappx/api/theme-change.md +742 -0
  755. package/data/uniappx/api/theme.md +3 -0
  756. package/data/uniappx/api/toast.md +180 -0
  757. package/data/uniappx/api/uni-push.md +513 -0
  758. package/data/uniappx/api/unicloud/README.md +87 -0
  759. package/data/uniappx/api/unicloud/database.md +1028 -0
  760. package/data/uniappx/api/unicloud/function.md +83 -0
  761. package/data/uniappx/api/unicloud/object.md +138 -0
  762. package/data/uniappx/api/unicloud/sse-channel.md +92 -0
  763. package/data/uniappx/api/unicloud/storage.md +204 -0
  764. package/data/uniappx/api/unicloud/utils.md +153 -0
  765. package/data/uniappx/api/unipage.md +263 -0
  766. package/data/uniappx/api/upload-file.md +233 -0
  767. package/data/uniappx/api/vibrate.md +177 -0
  768. package/data/uniappx/api/virtual-payment.md +517 -0
  769. package/data/uniappx/api/websocket-global.md +3 -0
  770. package/data/uniappx/api/websocket.md +562 -0
  771. package/data/uniappx/api/wide-screen-adaptation.md +433 -0
  772. package/data/uniappx/api/wifi.md +508 -0
  773. package/data/uniappx/api/window.md +86 -0
  774. package/data/uniappx/app-harmony/README.md +74 -0
  775. package/data/uniappx/app-harmony/harmony-vapor.md +3 -0
  776. package/data/uniappx/app-vapor.md +583 -0
  777. package/data/uniappx/benchmark/vapor-benchmark-android.md +483 -0
  778. package/data/uniappx/benchmark/vapor-benchmark-harmony.md +309 -0
  779. package/data/uniappx/benchmark/vapor-benchmark-ios.md +373 -0
  780. package/data/uniappx/collocation/_sidebar.md +15 -0
  781. package/data/uniappx/collocation/app.md +370 -0
  782. package/data/uniappx/collocation/manifest-android.md +1289 -0
  783. package/data/uniappx/collocation/manifest-harmony.md +152 -0
  784. package/data/uniappx/collocation/manifest-ios.md +709 -0
  785. package/data/uniappx/collocation/manifest-modules.md +508 -0
  786. package/data/uniappx/collocation/manifest-splashscreen.md +227 -0
  787. package/data/uniappx/collocation/manifest.md +745 -0
  788. package/data/uniappx/collocation/pagesjson.md +790 -0
  789. package/data/uniappx/collocation/themejson.md +176 -0
  790. package/data/uniappx/compiler/README.md +121 -0
  791. package/data/uniappx/compiler/_sidebar.md +4 -0
  792. package/data/uniappx/component/README.md +206 -0
  793. package/data/uniappx/component/_sidebar.md +118 -0
  794. package/data/uniappx/component/ad-custom.md +29 -0
  795. package/data/uniappx/component/ad.md +124 -0
  796. package/data/uniappx/component/animation-view.md +51 -0
  797. package/data/uniappx/component/aria-component.md +21 -0
  798. package/data/uniappx/component/audio.md +4 -0
  799. package/data/uniappx/component/block.md +26 -0
  800. package/data/uniappx/component/button.md +298 -0
  801. package/data/uniappx/component/camera.md +303 -0
  802. package/data/uniappx/component/canvas.md +230 -0
  803. package/data/uniappx/component/channel-live.md +27 -0
  804. package/data/uniappx/component/channel-video.md +38 -0
  805. package/data/uniappx/component/checkbox-group.md +56 -0
  806. package/data/uniappx/component/checkbox.md +247 -0
  807. package/data/uniappx/component/common.md +637 -0
  808. package/data/uniappx/component/cover-image.md +42 -0
  809. package/data/uniappx/component/cover-view.md +93 -0
  810. package/data/uniappx/component/custom-tab-bar.md +36 -0
  811. package/data/uniappx/component/double-tap-gesture-handler.md +36 -0
  812. package/data/uniappx/component/draggable-sheet.md +31 -0
  813. package/data/uniappx/component/editor.md +329 -0
  814. package/data/uniappx/component/flow-item.md +3 -0
  815. package/data/uniappx/component/force-press-gesture-handler.md +36 -0
  816. package/data/uniappx/component/form.md +378 -0
  817. package/data/uniappx/component/functional-page-navigator.md +43 -0
  818. package/data/uniappx/component/glass-effect-view.md +217 -0
  819. package/data/uniappx/component/grid-builder.md +39 -0
  820. package/data/uniappx/component/grid-view.md +35 -0
  821. package/data/uniappx/component/horizontal-drag-gesture-handler.md +40 -0
  822. package/data/uniappx/component/icon.md +41 -0
  823. package/data/uniappx/component/image.md +264 -0
  824. package/data/uniappx/component/input.md +905 -0
  825. package/data/uniappx/component/keyboard-accessory.md +21 -0
  826. package/data/uniappx/component/label.md +134 -0
  827. package/data/uniappx/component/list-builder.md +36 -0
  828. package/data/uniappx/component/list-item.md +1 -0
  829. package/data/uniappx/component/list-view.md +508 -0
  830. package/data/uniappx/component/live-player.md +267 -0
  831. package/data/uniappx/component/live-pusher.md +343 -0
  832. package/data/uniappx/component/loading.md +309 -0
  833. package/data/uniappx/component/long-press-gesture-handler.md +40 -0
  834. package/data/uniappx/component/map.md +376 -0
  835. package/data/uniappx/component/match-media.md +132 -0
  836. package/data/uniappx/component/movable-area.md +37 -0
  837. package/data/uniappx/component/movable-view.md +157 -0
  838. package/data/uniappx/component/native-component.md +21 -0
  839. package/data/uniappx/component/native-view.md +342 -0
  840. package/data/uniappx/component/navigation-bar.md +44 -0
  841. package/data/uniappx/component/navigator.md +143 -0
  842. package/data/uniappx/component/nested-scroll-body.md +122 -0
  843. package/data/uniappx/component/nested-scroll-header.md +121 -0
  844. package/data/uniappx/component/nested-scroll.md +6 -0
  845. package/data/uniappx/component/official-account.md +21 -0
  846. package/data/uniappx/component/open-container.md +38 -0
  847. package/data/uniappx/component/page-container.md +386 -0
  848. package/data/uniappx/component/page-meta.md +79 -0
  849. package/data/uniappx/component/pan-gesture-handler.md +40 -0
  850. package/data/uniappx/component/picker-view-column.md +3 -0
  851. package/data/uniappx/component/picker-view.md +180 -0
  852. package/data/uniappx/component/picker.md +370 -0
  853. package/data/uniappx/component/progress.md +163 -0
  854. package/data/uniappx/component/radio-group.md +56 -0
  855. package/data/uniappx/component/radio.md +218 -0
  856. package/data/uniappx/component/rich-text.md +244 -0
  857. package/data/uniappx/component/root-portal.md +26 -0
  858. package/data/uniappx/component/scale-gesture-handler.md +45 -0
  859. package/data/uniappx/component/scroll-view.md +556 -0
  860. package/data/uniappx/component/share-element.md +221 -0
  861. package/data/uniappx/component/slider.md +232 -0
  862. package/data/uniappx/component/snapshot.md +30 -0
  863. package/data/uniappx/component/span.md +21 -0
  864. package/data/uniappx/component/sticky-header.md +138 -0
  865. package/data/uniappx/component/sticky-section.md +152 -0
  866. package/data/uniappx/component/sticky.md +6 -0
  867. package/data/uniappx/component/store-home.md +26 -0
  868. package/data/uniappx/component/store-product.md +28 -0
  869. package/data/uniappx/component/swiper-item.md +3 -0
  870. package/data/uniappx/component/swiper.md +380 -0
  871. package/data/uniappx/component/switch.md +189 -0
  872. package/data/uniappx/component/tap-gesture-handler.md +36 -0
  873. package/data/uniappx/component/text.md +384 -0
  874. package/data/uniappx/component/textarea.md +603 -0
  875. package/data/uniappx/component/uni-ui-x/README.md +165 -0
  876. package/data/uniappx/component/uni-ui-x/uni-badge-view.md +260 -0
  877. package/data/uniappx/component/uni-ui-x/uni-collapse-item.md +3 -0
  878. package/data/uniappx/component/uni-ui-x/uni-collapse.md +696 -0
  879. package/data/uniappx/component/uni-ui-x/uni-drag-cell.md +782 -0
  880. package/data/uniappx/component/uni-ui-x/uni-fab-button.md +137 -0
  881. package/data/uniappx/component/uni-ui-x/uni-index-bar.md +224 -0
  882. package/data/uniappx/component/uni-ui-x/uni-link.md +190 -0
  883. package/data/uniappx/component/uni-ui-x/uni-nav-bar.md +173 -0
  884. package/data/uniappx/component/uni-ui-x/uni-number-box.md +234 -0
  885. package/data/uniappx/component/uni-ui-x/uni-rate.md +151 -0
  886. package/data/uniappx/component/uni-ui-x/uni-refresh-box.md +250 -0
  887. package/data/uniappx/component/uni-ui-x/uni-tab-bar.md +3 -0
  888. package/data/uniappx/component/uni-ui-x/uni-tab-content.md +3 -0
  889. package/data/uniappx/component/uni-ui-x/uni-tab-item.md +3 -0
  890. package/data/uniappx/component/uni-ui-x/uni-tab-midbutton.md +3 -0
  891. package/data/uniappx/component/uni-ui-x/uni-tab.md +1161 -0
  892. package/data/uniappx/component/uni-ui-x/uni-time-format.md +213 -0
  893. package/data/uniappx/component/unicloud-db.md +270 -0
  894. package/data/uniappx/component/vertical-drag-gesture-handler.md +40 -0
  895. package/data/uniappx/component/video.md +627 -0
  896. package/data/uniappx/component/view.md +216 -0
  897. package/data/uniappx/component/voip-room.md +43 -0
  898. package/data/uniappx/component/waterflow.md +407 -0
  899. package/data/uniappx/component/web-view.md +460 -0
  900. package/data/uniappx/css/README.md +436 -0
  901. package/data/uniappx/css/_sidebar.md +104 -0
  902. package/data/uniappx/css/align-content.md +338 -0
  903. package/data/uniappx/css/align-items.md +276 -0
  904. package/data/uniappx/css/align-self.md +291 -0
  905. package/data/uniappx/css/animation-composition.md +33 -0
  906. package/data/uniappx/css/animation-delay.md +26 -0
  907. package/data/uniappx/css/animation-direction.md +34 -0
  908. package/data/uniappx/css/animation-duration.md +31 -0
  909. package/data/uniappx/css/animation-fill-mode.md +34 -0
  910. package/data/uniappx/css/animation-iteration-count.md +31 -0
  911. package/data/uniappx/css/animation-name.md +31 -0
  912. package/data/uniappx/css/animation-play-state.md +32 -0
  913. package/data/uniappx/css/animation-range-end.md +26 -0
  914. package/data/uniappx/css/animation-range-start.md +26 -0
  915. package/data/uniappx/css/animation-range.md +34 -0
  916. package/data/uniappx/css/animation-timeline.md +34 -0
  917. package/data/uniappx/css/animation-timing-function.md +45 -0
  918. package/data/uniappx/css/animation.md +36 -0
  919. package/data/uniappx/css/backdrop-filter.md +255 -0
  920. package/data/uniappx/css/background-clip.md +36 -0
  921. package/data/uniappx/css/background-color.md +353 -0
  922. package/data/uniappx/css/background-image.md +152 -0
  923. package/data/uniappx/css/background.md +35 -0
  924. package/data/uniappx/css/border-bottom-color.md +39 -0
  925. package/data/uniappx/css/border-bottom-left-radius.md +33 -0
  926. package/data/uniappx/css/border-bottom-right-radius.md +33 -0
  927. package/data/uniappx/css/border-bottom-style.md +37 -0
  928. package/data/uniappx/css/border-bottom-width.md +44 -0
  929. package/data/uniappx/css/border-bottom.md +201 -0
  930. package/data/uniappx/css/border-color.md +284 -0
  931. package/data/uniappx/css/border-left-color.md +34 -0
  932. package/data/uniappx/css/border-left-style.md +37 -0
  933. package/data/uniappx/css/border-left-width.md +44 -0
  934. package/data/uniappx/css/border-left.md +200 -0
  935. package/data/uniappx/css/border-radius.md +391 -0
  936. package/data/uniappx/css/border-right-color.md +34 -0
  937. package/data/uniappx/css/border-right-style.md +37 -0
  938. package/data/uniappx/css/border-right-width.md +44 -0
  939. package/data/uniappx/css/border-right.md +201 -0
  940. package/data/uniappx/css/border-style.md +271 -0
  941. package/data/uniappx/css/border-top-color.md +34 -0
  942. package/data/uniappx/css/border-top-left-radius.md +33 -0
  943. package/data/uniappx/css/border-top-right-radius.md +33 -0
  944. package/data/uniappx/css/border-top-style.md +37 -0
  945. package/data/uniappx/css/border-top-width.md +44 -0
  946. package/data/uniappx/css/border-top.md +201 -0
  947. package/data/uniappx/css/border-width.md +415 -0
  948. package/data/uniappx/css/border.md +302 -0
  949. package/data/uniappx/css/bottom.md +259 -0
  950. package/data/uniappx/css/box-shadow.md +879 -0
  951. package/data/uniappx/css/box-sizing.md +353 -0
  952. package/data/uniappx/css/color.md +158 -0
  953. package/data/uniappx/css/common/at-rules.md +244 -0
  954. package/data/uniappx/css/common/color.md +40 -0
  955. package/data/uniappx/css/common/function.md +661 -0
  956. package/data/uniappx/css/common/length.md +178 -0
  957. package/data/uniappx/css/common/selector.md +55 -0
  958. package/data/uniappx/css/common/style-isolation.md +215 -0
  959. package/data/uniappx/css/common/variable.md +1 -0
  960. package/data/uniappx/css/css_diff_web.md +802 -0
  961. package/data/uniappx/css/direction.md +146 -0
  962. package/data/uniappx/css/display.md +42 -0
  963. package/data/uniappx/css/flex-basis.md +306 -0
  964. package/data/uniappx/css/flex-direction.md +243 -0
  965. package/data/uniappx/css/flex-flow.md +283 -0
  966. package/data/uniappx/css/flex-grow.md +318 -0
  967. package/data/uniappx/css/flex-shrink.md +313 -0
  968. package/data/uniappx/css/flex-wrap.md +259 -0
  969. package/data/uniappx/css/flex.md +216 -0
  970. package/data/uniappx/css/font-family.md +187 -0
  971. package/data/uniappx/css/font-size.md +176 -0
  972. package/data/uniappx/css/font-style.md +139 -0
  973. package/data/uniappx/css/font-weight.md +167 -0
  974. package/data/uniappx/css/height.md +239 -0
  975. package/data/uniappx/css/justify-content.md +286 -0
  976. package/data/uniappx/css/left.md +260 -0
  977. package/data/uniappx/css/letter-spacing.md +149 -0
  978. package/data/uniappx/css/line-height.md +173 -0
  979. package/data/uniappx/css/lines.md +37 -0
  980. package/data/uniappx/css/margin-bottom.md +281 -0
  981. package/data/uniappx/css/margin-left.md +281 -0
  982. package/data/uniappx/css/margin-right.md +278 -0
  983. package/data/uniappx/css/margin-top.md +274 -0
  984. package/data/uniappx/css/margin.md +315 -0
  985. package/data/uniappx/css/max-height.md +242 -0
  986. package/data/uniappx/css/max-width.md +251 -0
  987. package/data/uniappx/css/min-height.md +252 -0
  988. package/data/uniappx/css/min-width.md +243 -0
  989. package/data/uniappx/css/opacity.md +248 -0
  990. package/data/uniappx/css/overflow.md +330 -0
  991. package/data/uniappx/css/padding-bottom.md +241 -0
  992. package/data/uniappx/css/padding-left.md +234 -0
  993. package/data/uniappx/css/padding-right.md +242 -0
  994. package/data/uniappx/css/padding-top.md +234 -0
  995. package/data/uniappx/css/padding.md +309 -0
  996. package/data/uniappx/css/pointer-events.md +155 -0
  997. package/data/uniappx/css/position.md +444 -0
  998. package/data/uniappx/css/right.md +260 -0
  999. package/data/uniappx/css/text-align.md +154 -0
  1000. package/data/uniappx/css/text-decoration-color.md +35 -0
  1001. package/data/uniappx/css/text-decoration-line.md +144 -0
  1002. package/data/uniappx/css/text-decoration-style.md +41 -0
  1003. package/data/uniappx/css/text-decoration-thickness.md +39 -0
  1004. package/data/uniappx/css/text-decoration.md +52 -0
  1005. package/data/uniappx/css/text-overflow.md +176 -0
  1006. package/data/uniappx/css/text-shadow.md +146 -0
  1007. package/data/uniappx/css/top.md +258 -0
  1008. package/data/uniappx/css/transform-origin.md +298 -0
  1009. package/data/uniappx/css/transform.md +50 -0
  1010. package/data/uniappx/css/transition-delay.md +253 -0
  1011. package/data/uniappx/css/transition-duration.md +275 -0
  1012. package/data/uniappx/css/transition-property.md +67 -0
  1013. package/data/uniappx/css/transition-timing-function.md +259 -0
  1014. package/data/uniappx/css/transition.md +527 -0
  1015. package/data/uniappx/css/visibility.md +198 -0
  1016. package/data/uniappx/css/white-space.md +162 -0
  1017. package/data/uniappx/css/width.md +300 -0
  1018. package/data/uniappx/css/z-index.md +411 -0
  1019. package/data/uniappx/debug/android-inspector.md +54 -0
  1020. package/data/uniappx/i18n.md +358 -0
  1021. package/data/uniappx/mp/README.md +159 -0
  1022. package/data/uniappx/native/README.md +65 -0
  1023. package/data/uniappx/native/debug/android.md +122 -0
  1024. package/data/uniappx/native/debug/harmony.md +116 -0
  1025. package/data/uniappx/native/debug/ios.md +84 -0
  1026. package/data/uniappx/native/download/android.md +45 -0
  1027. package/data/uniappx/native/download/ios.md +29 -0
  1028. package/data/uniappx/native/modules/android/others.md +1343 -0
  1029. package/data/uniappx/native/modules/android/uni-ad.md +99 -0
  1030. package/data/uniappx/native/modules/android/uni-facialRecognitionVerify.md +69 -0
  1031. package/data/uniappx/native/modules/android/uni-getLocation.md +121 -0
  1032. package/data/uniappx/native/modules/android/uni-map-tencent.md +92 -0
  1033. package/data/uniappx/native/modules/android/uni-oauth.md +57 -0
  1034. package/data/uniappx/native/modules/android/uni-payment.md +110 -0
  1035. package/data/uniappx/native/modules/android/uni-push.md +217 -0
  1036. package/data/uniappx/native/modules/android/uni-share.md +57 -0
  1037. package/data/uniappx/native/modules/android/uni-verify.md +101 -0
  1038. package/data/uniappx/native/modules/android/uni-video.md +125 -0
  1039. package/data/uniappx/native/modules/harmony/facialVerify.md +45 -0
  1040. package/data/uniappx/native/modules/harmony/location.md +43 -0
  1041. package/data/uniappx/native/modules/harmony/map.md +64 -0
  1042. package/data/uniappx/native/modules/harmony/modules.md +23 -0
  1043. package/data/uniappx/native/modules/harmony/oauth.md +47 -0
  1044. package/data/uniappx/native/modules/harmony/pay.md +85 -0
  1045. package/data/uniappx/native/modules/harmony/push.md +74 -0
  1046. package/data/uniappx/native/modules/harmony/verify.md +45 -0
  1047. package/data/uniappx/native/modules/ios/modules.md +943 -0
  1048. package/data/uniappx/native/permission/android_permission_adapter.md +62 -0
  1049. package/data/uniappx/native/use/android.md +521 -0
  1050. package/data/uniappx/native/use/androidcomm.md +104 -0
  1051. package/data/uniappx/native/use/androiduts.md +388 -0
  1052. package/data/uniappx/native/use/harmony.md +99 -0
  1053. package/data/uniappx/native/use/harmonyapi.md +190 -0
  1054. package/data/uniappx/native/use/harmonyuts.md +62 -0
  1055. package/data/uniappx/native/use/ios.md +90 -0
  1056. package/data/uniappx/native/use/iosapi.md +288 -0
  1057. package/data/uniappx/native/use/iosuts.md +87 -0
  1058. package/data/uniappx/page.md +486 -0
  1059. package/data/uniappx/performance.md +175 -0
  1060. package/data/uniappx/plugin/NOTE.md +5 -0
  1061. package/data/uniappx/project.md +149 -0
  1062. package/data/uniappx/readme.md +381 -0
  1063. package/data/uniappx/release-note-alpha.md +2219 -0
  1064. package/data/uniappx/release.md +1961 -0
  1065. package/data/uniappx/sample.md +157 -0
  1066. package/data/uniappx/select.md +3 -0
  1067. package/data/uniappx/tutorial/android-16kb.md +87 -0
  1068. package/data/uniappx/tutorial/android-memoryleak.md +542 -0
  1069. package/data/uniappx/tutorial/app-env.md +80 -0
  1070. package/data/uniappx/tutorial/app-market.md +51 -0
  1071. package/data/uniappx/tutorial/app-package.md +195 -0
  1072. package/data/uniappx/tutorial/app-playground.md +188 -0
  1073. package/data/uniappx/tutorial/bug_repair.md +40 -0
  1074. package/data/uniappx/tutorial/codegap.md +223 -0
  1075. package/data/uniappx/tutorial/compatibility.md +119 -0
  1076. package/data/uniappx/tutorial/compliance.md +671 -0
  1077. package/data/uniappx/tutorial/debug/devtools.md +134 -0
  1078. package/data/uniappx/tutorial/idref.md +121 -0
  1079. package/data/uniappx/tutorial/ls-plugin.md +181 -0
  1080. package/data/uniappx/tutorial/request.md +204 -0
  1081. package/data/uniappx/tutorial/rules_mcp.md +121 -0
  1082. package/data/uniappx/tutorial/stickynestlist.md +68 -0
  1083. package/data/uniappx/tutorial/store.md +130 -0
  1084. package/data/uniappx/uniapptox.md +145 -0
  1085. package/data/uniappx/uts/README.md +441 -0
  1086. package/data/uniappx/uts/_sidebar.md +55 -0
  1087. package/data/uniappx/uts/buildin-object-api/array.md +2265 -0
  1088. package/data/uniappx/uts/buildin-object-api/arraybuffer.md +480 -0
  1089. package/data/uniappx/uts/buildin-object-api/console.md +520 -0
  1090. package/data/uniappx/uts/buildin-object-api/dataview.md +853 -0
  1091. package/data/uniappx/uts/buildin-object-api/date.md +1534 -0
  1092. package/data/uniappx/uts/buildin-object-api/error.md +30 -0
  1093. package/data/uniappx/uts/buildin-object-api/float32array.md +581 -0
  1094. package/data/uniappx/uts/buildin-object-api/float64array.md +626 -0
  1095. package/data/uniappx/uts/buildin-object-api/global.md +600 -0
  1096. package/data/uniappx/uts/buildin-object-api/int16array.md +1069 -0
  1097. package/data/uniappx/uts/buildin-object-api/int32array.md +1137 -0
  1098. package/data/uniappx/uts/buildin-object-api/int8array.md +1166 -0
  1099. package/data/uniappx/uts/buildin-object-api/json.md +407 -0
  1100. package/data/uniappx/uts/buildin-object-api/map.md +479 -0
  1101. package/data/uniappx/uts/buildin-object-api/math.md +1525 -0
  1102. package/data/uniappx/uts/buildin-object-api/number.md +852 -0
  1103. package/data/uniappx/uts/buildin-object-api/promise.md +1444 -0
  1104. package/data/uniappx/uts/buildin-object-api/regexp.md +534 -0
  1105. package/data/uniappx/uts/buildin-object-api/set.md +317 -0
  1106. package/data/uniappx/uts/buildin-object-api/string.md +1604 -0
  1107. package/data/uniappx/uts/buildin-object-api/textdecoder.md +133 -0
  1108. package/data/uniappx/uts/buildin-object-api/textencoder.md +60 -0
  1109. package/data/uniappx/uts/buildin-object-api/timers.md +145 -0
  1110. package/data/uniappx/uts/buildin-object-api/uint16array.md +1154 -0
  1111. package/data/uniappx/uts/buildin-object-api/uint32array.md +1165 -0
  1112. package/data/uniappx/uts/buildin-object-api/uint8array.md +1146 -0
  1113. package/data/uniappx/uts/buildin-object-api/uint8clampedarray.md +1147 -0
  1114. package/data/uniappx/uts/buildin-object-api/utsjsonobject.md +1297 -0
  1115. package/data/uniappx/uts/class.md +462 -0
  1116. package/data/uniappx/uts/compiler-known-issues.md +865 -0
  1117. package/data/uniappx/uts/conditional.md +206 -0
  1118. package/data/uniappx/uts/data-type.md +2242 -0
  1119. package/data/uniappx/uts/enumerability.md +15 -0
  1120. package/data/uniappx/uts/enumerability_iterable.md +200 -0
  1121. package/data/uniappx/uts/exception.md +25 -0
  1122. package/data/uniappx/uts/function.md +358 -0
  1123. package/data/uniappx/uts/generics.md +246 -0
  1124. package/data/uniappx/uts/interface.md +35 -0
  1125. package/data/uniappx/uts/iterable.md +137 -0
  1126. package/data/uniappx/uts/keywords.md +393 -0
  1127. package/data/uniappx/uts/literal.md +216 -0
  1128. package/data/uniappx/uts/loops.md +236 -0
  1129. package/data/uniappx/uts/module.md +92 -0
  1130. package/data/uniappx/uts/object.md +155 -0
  1131. package/data/uniappx/uts/operator.md +295 -0
  1132. package/data/uniappx/uts/runtime-known-issues.md +94 -0
  1133. package/data/uniappx/uts/type-aliases.md +43 -0
  1134. package/data/uniappx/uts/type-compatibility.md +133 -0
  1135. package/data/uniappx/uts/uts-optimize.md +33 -0
  1136. package/data/uniappx/uts/uts_diff_ts.md +2443 -0
  1137. package/data/uniappx/uts/utsactivitycallback.md +3099 -0
  1138. package/data/uniappx/uts/utsandroid.md +1461 -0
  1139. package/data/uniappx/uts/utsandroidhookproxy.md +34 -0
  1140. package/data/uniappx/uts/utsharmony.md +348 -0
  1141. package/data/uniappx/uts/utsios.md +466 -0
  1142. package/data/uniappx/uts/utsioshookproxy.md +374 -0
  1143. package/data/uniappx/vapor-benchmark.md +9 -0
  1144. package/data/uniappx/vue/README.md +384 -0
  1145. package/data/uniappx/vue/_sidebar.md +10 -0
  1146. package/data/uniappx/vue/advanced-api.md +253 -0
  1147. package/data/uniappx/vue/built-in.md +2133 -0
  1148. package/data/uniappx/vue/component.md +1134 -0
  1149. package/data/uniappx/vue/composition-api.md +2169 -0
  1150. package/data/uniappx/vue/data-bind.md +463 -0
  1151. package/data/uniappx/vue/global-api.md +307 -0
  1152. package/data/uniappx/vue/modifier.md +249 -0
  1153. package/data/uniappx/vue/options-api.md +1489 -0
  1154. package/data/uniappx/vue/others.md +20 -0
  1155. package/data/uniappx/web/README.md +263 -0
  1156. package/data/uniappx/web/ssr.md +238 -0
  1157. package/data/uniappx/worktile/NOTE.md +5 -0
  1158. package/data/uniappx-doc-index.json +7664 -0
  1159. package/dist/main.mjs +67 -45
  1160. package/package.json +1 -1
@@ -0,0 +1,2169 @@
1
+ # 组合式 API
2
+
3
+ > `App.uvue` 从HBuilderX 5.0+起支持组合式 API。
4
+
5
+ ::: warning Android注意
6
+ - 暂不支持 `
7
+ ```
8
+
9
+ - 使用 `<template ref>`
10
+
11
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/component-instance/refs/refs-composition.uvue)
12
+
13
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/component-instance/refs/refs-composition
14
+
15
+ ```vue
16
+ <template>
17
+ <view class="page">
18
+ <view class="row">
19
+ <text>NodeRef: </text>
20
+ <text ref="nodeRef">{{ dataInfo.existRef }}</text>
21
+ </view>
22
+ <view class="row">
23
+ <text>childRef:</text>
24
+ <text>{{ dataInfo.existChildRef }}</text>
25
+ </view>
26
+ <view class="row">
27
+ <text>existTextItems:</text>
28
+ <text>{{ dataInfo.existTextItems }}</text>
29
+ </view>
30
+ <view>
31
+ <text v-for="item in dataInfo.textItemsExpectNum" ref="textItems" :key="item">{{
32
+ item
33
+ }}</text>
34
+ </view>
35
+ <child class="mt-10" ref="childRef">ComponentRef</child>
36
+ <view class="mt-10">
37
+ <text class="section-title">getCurrentInstance() + $refs</text>
38
+ </view>
39
+ <view class="row">
40
+ <text>$refs 获取 nodeRef:</text>
41
+ <text>{{ dataInfo.existRefByRefs }}</text>
42
+ </view>
43
+ <view class="row">
44
+ <text>$refs 获取 childRef:</text>
45
+ <text>{{ dataInfo.existChildRefByRefs }}</text>
46
+ </view>
47
+ </view>
48
+ </template>
49
+
50
+ <style>
51
+ .row {
52
+ display: flex;
53
+ flex-direction: row;
54
+ justify-content: space-between;
55
+ margin-bottom: 10px;
56
+ }
57
+ .section-title {
58
+ margin-bottom: 10px;
59
+ }
60
+ </style>
61
+ ```
62
+
63
+ #### watch
64
+
65
+ 侦听一个或多个响应式数据源,并在数据源变化时调用所给的回调函数。
66
+
67
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/core/watch/watch-composition.uvue)
68
+
69
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/core/watch/watch-composition
70
+
71
+ ```vue
72
+ <template>
73
+
74
+ <scroll-view style="flex: 1; padding-bottom: 20px">
75
+
76
+ <view class="page">
77
+ <view class="flex justify-between flex-row mb-10">
78
+ <text>count:</text>
79
+ <text id="count" ref="countRef">{{ count }}</text>
80
+ </view>
81
+ <view class="flex justify-between mb-10">
82
+ <text>watch count result:</text>
83
+ <text id="watch-count-res">{{ watchCountRes }}</text>
84
+ </view>
85
+ <view class="flex justify-between flex-row mb-10">
86
+ <text>watch count track number:</text>
87
+ <text id="watch-count-track-num">{{ watchCountTrackNum }}</text>
88
+ </view>
89
+ <view class="flex justify-between mb-10">
90
+ <text>watch count cleanup number:</text>
91
+ <text id="watch-count-cleanup-res">{{ watchCountCleanupRes }}</text>
92
+ </view>
93
+
94
+ <button class="increment-btn mb-10" @click="increment">increment</button>
95
+ <button class="stop-watch-count-btn mb-10" @click="triggerStopWatchCount">
96
+ stop watch count
97
+ </button>
98
+
99
+ <view class="flex justify-between flex-row mb-10">
100
+ <text>obj.str:</text>
101
+ <text id="obj-str" ref="objStrRef">{{ obj.str }}</text>
102
+ </view>
103
+ <view class="flex justify-between flex-row mb-10">
104
+ <text>watch obj.str trigger number:</text>
105
+ <text id="watch-obj-str-trigger-num">{{ watchObjStrTriggerNum }}</text>
106
+ </view>
107
+ <view class="flex justify-between flex-row mb-10">
108
+ <text>obj.num:</text>
109
+ <text id="obj-num">{{ obj.num }}</text>
110
+ </view>
111
+ <view class="flex justify-between flex-row mb-10">
112
+ <text>obj.bool:</text>
113
+ <text id="obj-bool" ref="objBoolRef">{{ obj.bool }}</text>
114
+ </view>
115
+ <view class="flex justify-between flex-row mb-10">
116
+ <text>obj.arr:</text>
117
+ <text id="obj-arr" ref="objArrRef">{{ JSON.stringify(obj.arr) }}</text>
118
+ </view>
119
+ <view class="flex justify-between mb-10">
120
+ <text>watch obj result:</text>
121
+ <text id="watch-obj-res">{{ watchObjRes }}</text>
122
+ </view>
123
+ <view class="flex justify-between mb-10">
124
+ <text>watch obj.str result:</text>
125
+ <text id="watch-obj-str-res">{{ watchObjStrRes }}</text>
126
+ </view>
127
+ <view class="flex justify-between mb-10">
128
+ <text>watch obj.bool result:</text>
129
+ <text id="watch-obj-bool-res">{{ watchObjBoolRes }}</text>
130
+ </view>
131
+ <view class="flex justify-between mb-10">
132
+ <text>watch obj.arr result:</text>
133
+ <text id="watch-obj-arr-res">{{ watchObjArrRes }}</text>
134
+ </view>
135
+
136
+ <button class="update-obj-btn mb-10" @click="updateObj">
137
+ update obj
138
+ </button>
139
+
140
+ <view class="flex justify-between mb-10">
141
+ <text>watch count and obj.num result:</text>
142
+ <text id="watch-count-obj-num-res">{{ watchCountAndObjNumRes }}</text>
143
+ </view>
144
+ </view>
145
+
146
+ </scroll-view>
147
+
148
+ </template>
149
+
150
+
151
+
152
+ ```
153
+
154
+ ##### 即时回调的侦听器​
155
+ `watch` 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
156
+
157
+ 我们可以通过传入 `immediate: true` 选项来强制侦听器的回调立即执行:
158
+
159
+ ```js
160
+ watch(
161
+ source,
162
+ (newValue, oldValue) => {
163
+ // 立即执行,且当 `source` 改变时再次执行
164
+ },
165
+ { immediate: true }
166
+ )
167
+ ```
168
+
169
+ #### computed
170
+
171
+ 接受一个 getter 函数,返回一个只读的响应式 [ref](#ref) 对象。该 ref 通过 `.value` 暴露 getter 函数的返回值。它也可以接受一个带有 `get` 和 `set` 函数的对象来创建一个可写的 ref 对象。
172
+
173
+ ::: warning 注意
174
+ - `computed()` 需通过泛型指定返回值类型。
175
+ ```ts
176
+ const count = ref(0)
177
+ const doubleCount = computed<number>(() : number => {
178
+ return count.value * 2
179
+ })
180
+ ```
181
+ - 目前需要可传参的计算属性时,需要手动指定返回值类型
182
+ ```ts
183
+ const stateText = computed(() : (state : number) => string => {
184
+ return (state : number) : string => {
185
+ const stateArr = ['未审核', '审核中', '审核通过']
186
+ return stateArr[state]
187
+ }
188
+ })
189
+ stateText.value(1)
190
+ ```
191
+
192
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/core/computed/computed-composition.uvue)
193
+
194
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/core/computed/computed-composition
195
+
196
+ ```vue
197
+ <template>
198
+ <view class="page">
199
+ <view class="flex justify-between flex-row mb-10">
200
+ <text>count:</text>
201
+ <text id="count">{{ count }}</text>
202
+ </view>
203
+ <view class="flex justify-between flex-row mb-10">
204
+ <text>computed double count:</text>
205
+ <text id="double-count">{{ doubleCount }}</text>
206
+ </view>
207
+ <view class="flex justify-between flex-row mb-10">
208
+ <text>computed triple count:</text>
209
+ <text id="triple-count">{{ tripleCount }}</text>
210
+ </view>
211
+ <view class="flex justify-between flex-row mb-10">
212
+ <text>obj.arr:</text>
213
+ <text id="obj-arr">{{ JSON.stringify(obj.arr) }}</text>
214
+ </view>
215
+ <view class="flex justify-between flex-row mb-10">
216
+ <text>computed obj.arr.length:</text>
217
+ <text id="obj-arr-len">{{ objArrLen }}</text>
218
+ </view>
219
+ <view class="flex justify-between flex-row mb-10">
220
+ <text>computed stateText(1):</text>
221
+ <text id="computed-with-argument">{{ stateText(1) }}</text>
222
+ </view>
223
+ <button id="update-btn" @click="update">update</button>
224
+ </view>
225
+ </template>
226
+
227
+
228
+
229
+ ```
230
+
231
+ #### reactive
232
+
233
+ 返回一个对象的响应式代理。
234
+
235
+ - 详细信息
236
+
237
+ 响应式转换是“深层”的:它会影响到所有嵌套的属性。一个响应式对象也将深层地解包任何 [ref](#ref) 属性,同时保持响应性。
238
+
239
+ 若要避免深层响应式转换,只想保留对这个对象顶层次访问的响应性,请使用 [shallowReactive()](#shallowreactive) 作替代。
240
+
241
+ ::: warning 注意
242
+ - `reactive` 在 app-android 平台目前不支持对 class 做响应式,推荐使用 type 定义存储数据的对象类型。
243
+
244
+ - 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/core/reactive/reactive.uvue)
245
+
246
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/core/reactive/reactive
247
+
248
+ ```vue
249
+ <template>
250
+
251
+ <scroll-view style="flex: 1;">
252
+
253
+ <view class="page">
254
+ <view class="flex justify-between flex-row mb-10">
255
+ <text>count:</text>
256
+ <text id="count">{{ count }}</text>
257
+ </view>
258
+ <view class="flex justify-between flex-row mb-10">
259
+ <text>obj.str:</text>
260
+ <text id="obj-str">{{ obj['str'] }}</text>
261
+ </view>
262
+ <view class="flex justify-between flex-row mb-10">
263
+ <text>obj.num:</text>
264
+ <text id="obj-num">{{ obj['num'] }}</text>
265
+ </view>
266
+ <view class="flex justify-between flex-row mb-10">
267
+ <text>obj.arr:</text>
268
+ <text id="obj-arr">{{ JSON.stringify(obj['arr']) }}</text>
269
+ </view>
270
+ <view class="flex justify-between flex-row mb-10">
271
+ <text>count1:</text>
272
+ <text id="count1">{{ count1 }}</text>
273
+ </view>
274
+ <view class="flex justify-between flex-row mb-10">
275
+ <text>obj1.a.b.c:</text>
276
+ <text id="obj1-a-b-c">{{ obj1.getString('a.b.c') }}</text>
277
+ </view>
278
+ <view class="flex justify-between flex-row mb-10">
279
+ <text>arr1(spread):</text>
280
+ <text id="arr1">{{ JSON.stringify(arr1) }}</text>
281
+ </view>
282
+ <view class="flex justify-between flex-row mb-10">
283
+ <text>arr2ForEachEffectCount:</text>
284
+ <text id="arr2">{{ arr2ForEachEffectCount }}</text>
285
+ </view>
286
+ <view class="flex justify-between flex-row mb-10">
287
+ <text>arr3(reverse):</text>
288
+ <text id="arr3">{{ JSON.stringify(arr3) }}</text>
289
+ </view>
290
+ <view class="flex justify-between flex-row mb-10">
291
+ <text>arr4(sort):</text>
292
+ <text id="arr4">{{ JSON.stringify(computedArr4) }}</text>
293
+ </view>
294
+ <view class="flex justify-between flex-row mb-10">
295
+ <text>arr5:</text>
296
+ <text id="arr5">{{ JSON.stringify(arr5Result) }}</text>
297
+ </view>
298
+ <view class="flex justify-between flex-row mb-10">
299
+ <text>map2ForEachEffectCount:</text>
300
+ <text id="map2">{{ map2ForEachEffectCount }}</text>
301
+ </view>
302
+ <view class="flex justify-between flex-row mb-10">
303
+ <text>map3ForOfEffectCount:</text>
304
+ <text id="map3">{{ map3ForOfEffectCount }}</text>
305
+ </view>
306
+ <view class="flex justify-between flex-row mb-10">
307
+ <text>set2ForEachEffectCount:</text>
308
+ <text id="set2">{{ set2ForEachEffectCount }}</text>
309
+ </view>
310
+ <view class="flex justify-between flex-row mb-10">
311
+ <text>set3ForOfEffectCount:</text>
312
+ <text id="set3">{{ set3ForOfEffectCount }}</text>
313
+ </view>
314
+ <view class="flex justify-between flex-row mb-10">
315
+ <text>response.data.success:</text>
316
+ <text id="generic">{{ response.data.success }}</text>
317
+ </view>
318
+ <view class="flex justify-between flex-row mb-10">
319
+ <text>reactive-str-id:</text>
320
+ <text id="reactive-str-id">{{ r1.getString(('id')) }}</text>
321
+ </view>
322
+ <view class="flex justify-between flex-row mb-10">
323
+ <text>reactive-str-boolean :</text>
324
+ <text id="reactive-str-boolean">{{ r1.getBoolean(('bl')) }}</text>
325
+ </view>
326
+ <view class="flex justify-between flex-row mb-10">
327
+ <text>reactive-str-number :</text>
328
+ <text id="reactive-str-number">{{ r1.getNumber(('n')) }}</text>
329
+ </view>
330
+ <view class="flex justify-between flex-row mb-10">
331
+ <text>reactive-str-any :</text>
332
+ <text id="reactive-str-any">{{ r1.getAny(('id')) }}</text>
333
+ </view>
334
+ <view class="flex justify-between flex-row mb-10">
335
+ <text>reactive-str-arr :</text>
336
+ <text id="reactive-str-arr">{{ r1.getArray(('arr'))![0] }}</text>
337
+ </view>
338
+ <view class="flex justify-between flex-row mb-10">
339
+ <text>reactive-str-json :</text>
340
+ <text id="reactive-str-json">{{ r1.getJSON(('cars[0]'))!['name'] }}</text>
341
+ </view>
342
+ <view class="flex justify-between flex-row mb-10">
343
+ <text>reactive-str:</text>
344
+ <text id="reactive-str">{{ r2.getString("msg") }}</text>
345
+ </view>
346
+ <button class='mb-10' id="update-count-btn" @click="updateCount">update count</button>
347
+ <button class='mb-10' id="update-obj-str-btn" @click="updateObjStr">update obj.str</button>
348
+ <button class='mb-10' id="update-obj-num-btn" @click="updateObjNum">update obj.num</button>
349
+ <button class='mb-10' id="update-obj-arr-btn" @click="updateObjArr">update obj.arr</button>
350
+ <button class='mb-10' id="update-obj1-a-b-c-btn" @click="updateObj1_A_B_C">update obj1.a.b.c</button>
351
+ <button class='mb-10' id="update-arr1-btn" @click="updateArr1(false)">update arr1 without reactive</button>
352
+ <button class='mb-10' id="update-arr1-reactive-btn" @click="updateArr1(true)">update arr1 with reactive</button>
353
+ <button class='mb-10' id="update-arr2-forEach-effect-btn" @click="updateArr2()">update arr2</button>
354
+ <button class='mb-10' id="update-arr4-btn" @click="updateArr4()">update arr4</button>
355
+ <button class='mb-10' id="update-map2-forEach-effect-btn" @click="updateMap2()">update map2 for each</button>
356
+ <button class='mb-10' id="update-map3-forOf-effect-btn" @click="updateMap3()">update map3 for of</button>
357
+ <button class='mb-10' id="update-set2-forEach-effect-btn" @click="updateSet2()">update set2 for each</button>
358
+ <button class='mb-10' id="update-set3-forOf-effect-btn" @click="updateSet3()">update set3 for of</button>
359
+ <button class='mb-10' id="update-generic" @click="updateResponse()">response.data.success</button>
360
+
361
+
362
+ <view class="flex justify-between flex-row mb-10 mt-20">
363
+ <text class="section-title">复杂场景</text>
364
+ </view>
365
+
366
+
367
+ <view class="mb-10">
368
+ <text>arrWithObj[0].name:</text>
369
+ <text id="arr-with-obj-name">{{ arrWithObj[0].name }}</text>
370
+ </view>
371
+ <view class="flex justify-between flex-row mb-10">
372
+ <text>arrWithObj[0].count:</text>
373
+ <text id="arr-with-obj-count">{{ arrWithObj[0].count }}</text>
374
+ </view>
375
+ <view class="flex justify-between flex-row mb-10">
376
+ <text>arrWithObj length:</text>
377
+ <text id="arr-with-obj-length">{{ arrWithObj.length }}</text>
378
+ </view>
379
+ <button class='mb-10' id="update-arr-with-obj-name-btn" @click="updateArrWithObjName()">update arrWithObj[0].name</button>
380
+ <button class='mb-10' id="update-arr-with-obj-count-btn" @click="updateArrWithObjCount()">update arrWithObj[0].count</button>
381
+ <button class='mb-10' id="push-arr-with-obj-btn" @click="pushArrWithObj()">push new obj to arrWithObj</button>
382
+
383
+
384
+ <view class="mb-10">
385
+ <text>objWithArr.items:</text>
386
+ <text id="obj-with-arr-items">{{ JSON.stringify(objWithArr.items) }}</text>
387
+ </view>
388
+ <view class="mb-10">
389
+ <text>objWithArr.items[0]:</text>
390
+ <text id="obj-with-arr-items-0">{{ (objWithArr['items'] as string[])[0] }}</text>
391
+ </view>
392
+ <view class="flex justify-between flex-row mb-10">
393
+ <text>objWithArr.items.length:</text>
394
+ <text id="obj-with-arr-items-length">{{ (objWithArr['items'] as string[]).length }}</text>
395
+ </view>
396
+ <button class='mb-10' id="update-obj-with-arr-items-0-btn" @click="updateObjWithArrItems0()">update objWithArr.items[0]</button>
397
+ <button class='mb-10' id="push-obj-with-arr-items-btn" @click="pushObjWithArrItems()">push to objWithArr.items</button>
398
+
399
+
400
+ <view class="flex justify-between flex-row mb-10">
401
+ <text>jsonParsedData.user.name:</text>
402
+ <text id="json-parsed-user-name">{{ jsonParsedData.getString('user.name') }}</text>
403
+ </view>
404
+ <view class="flex justify-between flex-row mb-10">
405
+ <text>jsonParsedData.user.age:</text>
406
+ <text id="json-parsed-user-age">{{ jsonParsedData.getNumber('user.age') }}</text>
407
+ </view>
408
+ <view class="mb-10">
409
+ <text>jsonParsedData.tags:</text>
410
+ <text id="json-parsed-tags">{{ JSON.stringify(jsonParsedData.tags) }}</text>
411
+ </view>
412
+ <view class="mb-10">
413
+ <text>jsonParsedData.items[0].title:</text>
414
+ <text id="json-parsed-items-0-title">{{ jsonParsedData.getJSON('items[0]')!.title }}</text>
415
+ </view>
416
+ <button class='mb-10' id="update-json-parsed-user-name-btn" @click="updateJsonParsedUserName()">update jsonParsedData.user.name</button>
417
+ <button class='mb-10' id="update-json-parsed-user-age-btn" @click="updateJsonParsedUserAge()">update jsonParsedData.user.age</button>
418
+ <button class='mb-10' id="push-json-parsed-tags-btn" @click="pushJsonParsedTags()">push to jsonParsedData.tags</button>
419
+ <button class='mb-10' id="update-json-parsed-items-0-title-btn" @click="updateJsonParsedItems0Title()">update jsonParsedData.items[0].title</button>
420
+
421
+
422
+ <view class="mb-10">
423
+ <text>complexData.users[0].profile.name:</text>
424
+ <text id="complex-users-0-profile-name">{{ ((complexData['users'] as UTSJSONObject[])[0] as UTSJSONObject).getString('profile.name') }}</text>
425
+ </view>
426
+ <view class="mb-10">
427
+ <text>complexData.users[0].hobbies[0]:</text>
428
+ <text id="complex-users-0-hobbies-0">{{ (((complexData['users'] as UTSJSONObject[])[0] as UTSJSONObject)['hobbies'] as string[])[0] }}</text>
429
+ </view>
430
+ <view class="flex justify-between flex-row mb-10">
431
+ <text>complexData.users[0].hobbies.length:</text>
432
+ <text id="complex-users-0-hobbies-length">{{ (((complexData['users'] as UTSJSONObject[])[0] as UTSJSONObject)['hobbies'] as string[]).length }}</text>
433
+ </view>
434
+ <view class="flex justify-between flex-row mb-10">
435
+ <text>complexData.meta.count:</text>
436
+ <text id="complex-meta-count">{{ (complexData['meta'] as UTSJSONObject)['count'] }}</text>
437
+ </view>
438
+ <button class='mb-10' id="update-complex-users-0-profile-name-btn" @click="updateComplexUsers0ProfileName()">update complexData.users[0].profile.name</button>
439
+ <button class='mb-10' id="update-complex-users-0-hobbies-0-btn" @click="updateComplexUsers0Hobbies0()">update complexData.users[0].hobbies[0]</button>
440
+ <button class='mb-10' id="push-complex-users-0-hobbies-btn" @click="pushComplexUsers0Hobbies()">push to complexData.users[0].hobbies</button>
441
+ <button class='mb-10' id="update-complex-meta-count-btn" @click="updateComplexMetaCount()">update complexData.meta.count</button>
442
+
443
+
444
+ <view class="flex justify-between flex-row mb-10">
445
+ <text>complexEffectCount:</text>
446
+ <text id="complex-effect-count">{{ complexEffectCount }}</text>
447
+ </view>
448
+ <view class="flex justify-between flex-row mb-10">
449
+ <text>jsonParsedEffectCount:</text>
450
+ <text id="json-parsed-effect-count">{{ jsonParsedEffectCount }}</text>
451
+ </view>
452
+ <button class='mb-10' id="trigger-complex-effect-btn" @click="triggerComplexEffect()">trigger complex effect</button>
453
+ <button class='mb-10' id="trigger-json-parsed-effect-btn" @click="triggerJsonParsedEffect()">trigger jsonParsed effect</button>
454
+
455
+
456
+ <view class="flex justify-between flex-row mb-10">
457
+ <text>arrWithObjForEachCount:</text>
458
+ <text id="arr-with-obj-forEach-count">{{ arrWithObjForEachCount }}</text>
459
+ </view>
460
+ <button class='mb-10' id="update-arr-with-obj-forEach-btn" @click="updateArrWithObjForEach()">update arrWithObj (forEach effect)</button>
461
+
462
+
463
+ <view class="mb-10">
464
+ <text>jsonObjWithArr.data.list:</text>
465
+ <text id="json-obj-with-arr-list">{{ JSON.stringify((jsonObjWithArr['data'] as UTSJSONObject)['list']) }}</text>
466
+ </view>
467
+ <view class="mb-10">
468
+ <text>jsonObjWithArr.data.list[0].value:</text>
469
+ <text id="json-obj-with-arr-list-0-value">{{ (((jsonObjWithArr['data'] as UTSJSONObject)['list'] as UTSJSONObject[])[0] as UTSJSONObject)['value'] }}</text>
470
+ </view>
471
+ <button class='mb-10' id="update-json-obj-with-arr-list-0-value-btn" @click="updateJsonObjWithArrList0Value()">update jsonObjWithArr.data.list[0].value</button>
472
+ <button class='mb-10' id="push-json-obj-with-arr-list-btn" @click="pushJsonObjWithArrList()">push to jsonObjWithArr.data.list</button>
473
+ </view>
474
+
475
+ </scroll-view>
476
+
477
+ </template>
478
+
479
+
480
+ <style>
481
+ .section-title {
482
+ font-size: 16px;
483
+ font-weight: bold;
484
+ margin-bottom: 10px;
485
+ }
486
+ </style>
487
+ ```
488
+
489
+ #### readonly
490
+
491
+ 接受一个对象 (不论是响应式还是普通的) 或是一个 [ref](#ref),返回一个原值的只读代理。
492
+
493
+ - 详细信息
494
+
495
+ 只读代理是深层的:对任何嵌套属性的访问都将是只读的。它的 [ref](#ref) 解包行为与 `reactive()` 相同,但解包得到的值是只读的。
496
+
497
+ 要避免深层级的转换行为,请使用 [shallowReadonly()](#shallowreadonly) 作替代。
498
+
499
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/core/readonly/readonly.uvue)
500
+
501
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/core/readonly/readonly
502
+
503
+ ```vue
504
+ <template>
505
+ <view class="page">
506
+ <view class="flex justify-between flex-row mb-10">
507
+ <text>data.str:</text>
508
+ <text id="data-str">{{ data.str }}</text>
509
+ </view>
510
+ <view class="flex justify-between flex-row mb-10">
511
+ <text>data.num:</text>
512
+ <text id="data-num">{{ data.num }}</text>
513
+ </view>
514
+ <view class="flex justify-between flex-row mb-10">
515
+ <text>data.arr:</text>
516
+ <text id="data-arr">{{ JSON.stringify(data.arr) }}</text>
517
+ </view>
518
+ <view class="flex justify-between flex-row mb-10">
519
+ <text>readonly data.str:</text>
520
+ <text id="readonly-data-str">{{ readonlyData.str }}</text>
521
+ </view>
522
+ <view class="flex justify-between flex-row mb-10">
523
+ <text>readonly data.num:</text>
524
+ <text id="readonly-data-num">{{ readonlyData.num }}</text>
525
+ </view>
526
+ <view class="flex justify-between flex-row mb-10">
527
+ <text>readonly data.arr:</text>
528
+ <text id="readonly-data-arr">{{ JSON.stringify(readonlyData.arr) }}</text>
529
+ </view>
530
+
531
+ <button id="update-data-btn" class="mb-10" @click="updateData">
532
+ update data
533
+ </button>
534
+ <button id="update-readonly-data-btn" @click="updateReadonlyData">
535
+ update readonly data
536
+ </button>
537
+ </view>
538
+ </template>
539
+
540
+
541
+
542
+ ```
543
+
544
+ #### watchEffect
545
+
546
+ 立即运行一个函数,同时响应式地追踪其依赖,并在依赖更改时重新执行。
547
+
548
+ - 详细信息
549
+
550
+ 第一个参数就是要运行的副作用函数。这个副作用函数的参数也是一个函数,用来注册清理回调。清理回调会在该副作用下一次执行前被调用,可以用来清理无效的副作用,例如等待中的异步请求 (参见下面的示例)。
551
+
552
+ 第二个参数是一个可选的选项,可以用来调整副作用的刷新时机或调试副作用的依赖。
553
+
554
+ 默认情况下,侦听器将在组件渲染之前执行。设置 `flush: 'post'` 将会使侦听器延迟到组件渲染之后再执行。在某些特殊情况下 (例如要使缓存失效),可能有必要在响应式依赖发生改变时立即触发侦听器。这可以通过设置 `flush: 'sync'` 来实现。然而,该设置应谨慎使用,因为如果有多个属性同时更新,这将导致一些性能和数据一致性的问题。
555
+
556
+ 返回值是一个用来停止该副作用的函数。
557
+
558
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/core/watch-effect/watch-effect.uvue)
559
+
560
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/core/watch-effect/watch-effect
561
+
562
+ ```vue
563
+ <template>
564
+
565
+ <scroll-view style="flex: 1; padding-bottom: 20px">
566
+
567
+ <view class="page">
568
+ <view class="flex justify-between flex-row mb-10">
569
+ <text>count:</text>
570
+ <text id="count" ref="countRef">{{ count }}</text>
571
+ </view>
572
+ <view class="flex justify-between mb-10">
573
+ <text>watch count result:</text>
574
+ <text id="watch-count-res">{{ watchCountRes }}</text>
575
+ </view>
576
+ <view class="flex justify-between flex-row mb-10">
577
+ <text>watch count track number:</text>
578
+ <text id="watch-count-track-num">{{ watchCountTrackNum }}</text>
579
+ </view>
580
+ <view class="flex justify-between mb-10">
581
+ <text>watch count cleanup number:</text>
582
+ <text id="watch-count-cleanup-res">{{ watchCountCleanupRes }}</text>
583
+ </view>
584
+
585
+ <button class="increment-btn mb-10" @click="increment">increment</button>
586
+ <button class="stop-watch-count-btn mb-10" @click="triggerStopWatchCount">
587
+ stop watch count
588
+ </button>
589
+
590
+ <view class="flex justify-between flex-row mb-10">
591
+ <text>obj.str:</text>
592
+ <text id="obj-str" ref="objStrRef">{{ obj.str }}</text>
593
+ </view>
594
+ <view class="flex justify-between flex-row mb-10">
595
+ <text>watch obj.str trigger number:</text>
596
+ <text id="watch-obj-str-trigger-num">{{ watchObjStrTriggerNum }}</text>
597
+ </view>
598
+ <view class="flex justify-between flex-row mb-10">
599
+ <text>obj.num:</text>
600
+ <text id="obj-num">{{ obj.num }}</text>
601
+ </view>
602
+ <view class="flex justify-between flex-row mb-10">
603
+ <text>obj.bool:</text>
604
+ <text id="obj-bool" ref="objBoolRef">{{ obj.bool }}</text>
605
+ </view>
606
+ <view class="flex justify-between flex-row mb-10">
607
+ <text>obj.arr:</text>
608
+ <text id="obj-arr" ref="objArrRef">{{ JSON.stringify(obj.arr) }}</text>
609
+ </view>
610
+ <view class="flex justify-between mb-10">
611
+ <text>watch obj result:</text>
612
+ <text id="watch-obj-res">{{ watchObjRes }}</text>
613
+ </view>
614
+ <view class="flex justify-between mb-10">
615
+ <text>watch obj.str result:</text>
616
+ <text id="watch-obj-str-res">{{ watchObjStrRes }}</text>
617
+ </view>
618
+ <view class="flex justify-between mb-10">
619
+ <text>watch obj.bool result:</text>
620
+ <text id="watch-obj-bool-res">{{ watchObjBoolRes }}</text>
621
+ </view>
622
+ <view class="flex justify-between mb-10">
623
+ <text>watch obj.arr result:</text>
624
+ <text id="watch-obj-arr-res">{{ watchObjArrRes }}</text>
625
+ </view>
626
+
627
+ <button class="update-obj-btn mb-10" @click="updateObj">
628
+ update obj
629
+ </button>
630
+
631
+ <view class="flex justify-between mb-10">
632
+ <text>watch count and obj.num result:</text>
633
+ <text id="watch-count-obj-num-res">{{ watchCountAndObjNumRes }}</text>
634
+ </view>
635
+ </view>
636
+
637
+ </scroll-view>
638
+
639
+ </template>
640
+
641
+
642
+ ```
643
+
644
+ #### watchPostEffect
645
+
646
+ [watchEffect()](#watcheffect) 使用 `flush: 'post'` 选项时的别名。
647
+
648
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/core/watch-post-effect/watch-post-effect.uvue)
649
+
650
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/core/watch-post-effect/watch-post-effect
651
+
652
+ ```vue
653
+ <template>
654
+
655
+ <scroll-view style="flex: 1; padding-bottom: 20px">
656
+
657
+ <view class="page">
658
+ <view class="flex justify-between flex-row mb-10">
659
+ <text>count:</text>
660
+ <text id="count" ref="countRef">{{ count }}</text>
661
+ </view>
662
+ <view class="flex justify-between mb-10">
663
+ <text>watch count result:</text>
664
+ <text id="watch-count-res">{{ watchCountRes }}</text>
665
+ </view>
666
+ <view class="flex justify-between flex-row mb-10">
667
+ <text>watch count track number:</text>
668
+ <text id="watch-count-track-num">{{ watchCountTrackNum }}</text>
669
+ </view>
670
+ <view class="flex justify-between mb-10">
671
+ <text>watch count cleanup number:</text>
672
+ <text id="watch-count-cleanup-res">{{ watchCountCleanupRes }}</text>
673
+ </view>
674
+
675
+ <button class="increment-btn mb-10" @click="increment">increment</button>
676
+ <button class="stop-watch-count-btn mb-10" @click="triggerStopWatchCount">
677
+ stop watch count
678
+ </button>
679
+
680
+ <view class="flex justify-between flex-row mb-10">
681
+ <text>obj.str:</text>
682
+ <text id="obj-str" ref="objStrRef">{{ obj.str }}</text>
683
+ </view>
684
+ <view class="flex justify-between flex-row mb-10">
685
+ <text>watch obj.str trigger number:</text>
686
+ <text id="watch-obj-str-trigger-num">{{ watchObjStrTriggerNum }}</text>
687
+ </view>
688
+ <view class="flex justify-between flex-row mb-10">
689
+ <text>obj.num:</text>
690
+ <text id="obj-num">{{ obj.num }}</text>
691
+ </view>
692
+ <view class="flex justify-between flex-row mb-10">
693
+ <text>obj.bool:</text>
694
+ <text id="obj-bool" ref="objBoolRef">{{ obj.bool }}</text>
695
+ </view>
696
+ <view class="flex justify-between flex-row mb-10">
697
+ <text>obj.arr:</text>
698
+ <text id="obj-arr" ref="objArrRef">{{ JSON.stringify(obj.arr) }}</text>
699
+ </view>
700
+ <view class="flex justify-between mb-10">
701
+ <text>watch obj result:</text>
702
+ <text id="watch-obj-res">{{ watchObjRes }}</text>
703
+ </view>
704
+ <view class="flex justify-between mb-10">
705
+ <text>watch obj.str result:</text>
706
+ <text id="watch-obj-str-res">{{ watchObjStrRes }}</text>
707
+ </view>
708
+ <view class="flex justify-between mb-10">
709
+ <text>watch obj.arr result:</text>
710
+ <text id="watch-obj-arr-res">{{ watchObjArrRes }}</text>
711
+ </view>
712
+
713
+ <button class="update-obj-btn mb-10" @click="updateObj">
714
+ update obj
715
+ </button>
716
+
717
+ <view class="flex justify-between mb-10">
718
+ <text>watch count and obj.num result:</text>
719
+ <text id="watch-count-obj-num-res">{{ watchCountAndObjNumRes }}</text>
720
+ </view>
721
+ </view>
722
+
723
+ </scroll-view>
724
+
725
+ </template>
726
+
727
+
728
+ ```
729
+
730
+ #### watchSyncEffect
731
+
732
+ [watchEffect()](#watcheffect) 使用 `flush: 'sync'` 选项时的别名。
733
+
734
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/core/watch-sync-effect/watch-sync-effect.uvue)
735
+
736
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/core/watch-sync-effect/watch-sync-effect
737
+
738
+ ```vue
739
+ <template>
740
+
741
+ <scroll-view style="flex: 1; padding-bottom: 20px">
742
+
743
+ <view class="page">
744
+ <view class="flex justify-between flex-row mb-10">
745
+ <text>count:</text>
746
+ <text id="count" ref="countRef">{{ count }}</text>
747
+ </view>
748
+ <view class="flex justify-between mb-10">
749
+ <text>watch count result:</text>
750
+ <text id="watch-count-res">{{ watchCountRes }}</text>
751
+ </view>
752
+ <view class="flex justify-between flex-row mb-10">
753
+ <text>watch count track number:</text>
754
+ <text id="watch-count-track-num">{{ watchCountTrackNum }}</text>
755
+ </view>
756
+ <view class="flex justify-between mb-10">
757
+ <text>watch count cleanup number:</text>
758
+ <text id="watch-count-cleanup-res">{{ watchCountCleanupRes }}</text>
759
+ </view>
760
+
761
+ <button class="increment-btn mb-10" @click="increment">increment</button>
762
+ <button class="stop-watch-count-btn mb-10" @click="triggerStopWatchCount">
763
+ stop watch count
764
+ </button>
765
+
766
+ <view class="flex justify-between flex-row mb-10">
767
+ <text>obj.str:</text>
768
+ <text id="obj-str" ref="objStrRef">{{ obj.str }}</text>
769
+ </view>
770
+ <view class="flex justify-between flex-row mb-10">
771
+ <text>watch obj.str trigger number:</text>
772
+ <text id="watch-obj-str-trigger-num">{{ watchObjStrTriggerNum }}</text>
773
+ </view>
774
+ <view class="flex justify-between flex-row mb-10">
775
+ <text>obj.num:</text>
776
+ <text id="obj-num">{{ obj.num }}</text>
777
+ </view>
778
+ <view class="flex justify-between flex-row mb-10">
779
+ <text>obj.bool:</text>
780
+ <text id="obj-bool" ref="objBoolRef">{{ obj.bool }}</text>
781
+ </view>
782
+ <view class="flex justify-between flex-row mb-10">
783
+ <text>obj.arr:</text>
784
+ <text id="obj-arr" ref="objArrRef">{{ JSON.stringify(obj.arr) }}</text>
785
+ </view>
786
+ <view class="flex justify-between mb-10">
787
+ <text>watch obj result:</text>
788
+ <text id="watch-obj-res">{{ watchObjRes }}</text>
789
+ </view>
790
+ <view class="flex justify-between mb-10">
791
+ <text>watch obj.str result:</text>
792
+ <text id="watch-obj-str-res">{{ watchObjStrRes }}</text>
793
+ </view>
794
+ <view class="flex justify-between mb-10">
795
+ <text>watch obj.arr result:</text>
796
+ <text id="watch-obj-arr-res">{{ watchObjArrRes }}</text>
797
+ </view>
798
+
799
+ <button class="update-obj-btn mb-10" @click="updateObj">
800
+ update obj
801
+ </button>
802
+
803
+ <view class="flex justify-between mb-10">
804
+ <text>watch count and obj.num result:</text>
805
+ <text id="watch-count-obj-num-res">{{ watchCountAndObjNumRes }}</text>
806
+ </view>
807
+ </view>
808
+
809
+ </scroll-view>
810
+
811
+ </template>
812
+
813
+
814
+ ```
815
+
816
+ ## 响应式: 工具
817
+
818
+ | | Web | 微信小程序 | Android | iOS | HarmonyOS |
819
+ | :- | :- | :- | :- | :- | :- |
820
+ | isRef() | 4.0 | 4.41 | 4.0 | 4.11 | 4.61 |
821
+ | unref() | 4.0 | 4.41 | 4.0 | 4.11 | 4.61 |
822
+ | toRef() | 4.11 | 4.41 | 4.0 | 4.11 | 4.61 |
823
+ | toValue() | 4.11 | 4.41 | 4.0 | 4.11 | 4.61 |
824
+ | toRefs() | 4.11 | 4.41 | 4.0 | 4.11 | 4.61 |
825
+ | isProxy() | 4.0 | 4.41 | 4.0 | 4.11 | 4.61 |
826
+ | isReactive() | 4.0 | 4.41 | 4.0 | 4.11 | 4.61 |
827
+ | isReadonly() | 4.0 | 4.41 | 4.0 | 4.11 | 4.61 |
828
+
829
+ ::: warning 注意
830
+ - `toRefs()` 仅支持 `Array` 和 `UTSJSONObject`, 不支持自定义类型。
831
+
832
+ ### 示例代码 @example
833
+
834
+ #### isRef
835
+
836
+ 检查某个值是否为 ref。
837
+
838
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/utilities/is-ref/is-ref.uvue)
839
+
840
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/utilities/is-ref/is-ref
841
+
842
+ ```vue
843
+ <template>
844
+ <view class="page">
845
+ <view class="flex justify-between flex-row mb-10">
846
+ <text>ref count:</text>
847
+ <text id="ref-count">{{ refCount }}</text>
848
+ </view>
849
+ <view class="flex justify-between flex-row mb-10">
850
+ <text>isRef ref count:</text>
851
+ <text id="is-ref-ref-count">{{ isRefRefCount }}</text>
852
+ </view>
853
+ <view class="flex justify-between flex-row mb-10">
854
+ <text>count:</text>
855
+ <text id="count">{{ count }}</text>
856
+ </view>
857
+ <view class="flex justify-between flex-row mb-10">
858
+ <text>isRef count:</text>
859
+ <text id="is-ref-count">{{ isRefCount }}</text>
860
+ </view>
861
+ </view>
862
+ </template>
863
+
864
+
865
+
866
+ ```
867
+
868
+ #### unref
869
+
870
+ 如果参数是 ref,则返回内部值,否则返回参数本身。这是 `val = isRef(val) ? val.value : val` 计算的一个语法糖。
871
+
872
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/utilities/un-ref/un-ref.uvue)
873
+
874
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/utilities/un-ref/un-ref
875
+
876
+ ```vue
877
+ <template>
878
+ <view class="page">
879
+ <view class="flex justify-between flex-row mb-10">
880
+ <text>ref count:</text>
881
+ <text id="ref-count">{{ refCount }}</text>
882
+ </view>
883
+ <view class="flex justify-between flex-row mb-10">
884
+ <text>ref count type:</text>
885
+ <text id="ref-count-type">{{ refCountType }}</text>
886
+ </view>
887
+ <view class="flex justify-between flex-row mb-10">
888
+ <text>count:</text>
889
+ <text id="count">{{ count }}</text>
890
+ </view>
891
+ <view class="flex justify-between flex-row mb-10">
892
+ <text>count type:</text>
893
+ <text id="count-type">{{ countType }}</text>
894
+ </view>
895
+ </view>
896
+ </template>
897
+
898
+
899
+
900
+ ```
901
+
902
+ #### toRef
903
+
904
+ 可以将值、refs 或 getters 规范化为 refs。
905
+
906
+ 也可以基于响应式对象上的一个属性,创建一个对应的 ref。这样创建的 ref 与其源属性保持同步:改变源属性的值将更新 ref 的值,反之亦然。
907
+
908
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/utilities/to-ref/to-ref.uvue)
909
+
910
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/utilities/to-ref/to-ref
911
+
912
+ ```vue
913
+ <template>
914
+ <view class="page">
915
+ <view class="flex justify-between flex-row mb-10">
916
+ <text>count:</text>
917
+ <text id="count">{{ count }}</text>
918
+ </view>
919
+ <view class="flex justify-between flex-row mb-10">
920
+ <text>isRef count:</text>
921
+ <text id="is-ref-count">{{ isRefCount }}</text>
922
+ </view>
923
+ <view class="flex justify-between flex-row mb-10">
924
+ <text>ref count:</text>
925
+ <text id="ref-count">{{ refCount }}</text>
926
+ </view>
927
+ <view class="flex justify-between flex-row mb-10">
928
+ <text>isRef ref count:</text>
929
+ <text id="is-ref-ref-count">{{ isRefRefCount }}</text>
930
+ </view>
931
+ <view class="flex justify-between flex-row mb-10">
932
+ <text>obj.num:</text>
933
+ <text id="obj-num">{{ obj.num }}</text>
934
+ </view>
935
+ <view class="flex justify-between flex-row mb-10">
936
+ <text>toRef(obj, "num"):</text>
937
+ <text id="to-ref-obj-num">{{ objNum }}</text>
938
+ </view>
939
+ <view class="flex justify-between flex-row mb-10">
940
+ <text>toRef(() => obj.num):</text>
941
+ <text id="to-ref-fn-obj-num">{{ readonlyObjNum }}</text>
942
+ </view>
943
+
944
+ <button class="mt-10" id="increment-btn" @click="increment">
945
+ increment obj.num
946
+ </button>
947
+ </view>
948
+ </template>
949
+
950
+
951
+
952
+ ```
953
+
954
+ #### toValue
955
+
956
+ 将值、refs 或 getters 规范化为值。这与 [unref()](#unref) 类似,不同的是此函数也会规范化 getter 函数。如果参数是一个 getter,它将会被调用并且返回它的返回值。
957
+
958
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/utilities/to-value/to-value.uvue)
959
+
960
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/utilities/to-value/to-value
961
+
962
+ ```vue
963
+ <template>
964
+ <view class="page">
965
+ <view class="flex justify-between flex-row mb-10">
966
+ <text>ref count:</text>
967
+ <text id="ref-count">{{ refCount }}</text>
968
+ </view>
969
+ <view class="flex justify-between flex-row mb-10">
970
+ <text>isRef ref count:</text>
971
+ <text id="is-ref-ref-count">{{ isRefRefCount }}</text>
972
+ </view>
973
+ <view class="flex justify-between flex-row mb-10">
974
+ <text>count:</text>
975
+ <text id="count">{{ count }}</text>
976
+ </view>
977
+ <view class="flex justify-between flex-row mb-10">
978
+ <text>isRef count:</text>
979
+ <text id="is-ref-count">{{ isRefCount }}</text>
980
+ </view>
981
+ <view class="flex justify-between flex-row mb-10">
982
+ <text>obj.num:</text>
983
+ <text id="obj-num">{{ obj.num }}</text>
984
+ </view>
985
+ <view class="flex justify-between flex-row mb-10">
986
+ <text>toValue(() => obj.num):</text>
987
+ <text id="to-value-obj-num">{{ toValueObjNum }}</text>
988
+ </view>
989
+ <button class="mt-10" id="increment-btn" @click="increment">
990
+ increment obj.num
991
+ </button>
992
+ </view>
993
+ </template>
994
+
995
+
996
+
997
+ ```
998
+
999
+ #### toRefs
1000
+
1001
+ 将一个响应式对象转换为一个普通对象,这个普通对象的每个属性都是指向源对象相应属性的 ref。每个单独的 ref 都是使用 [toRef()](#toref) 创建的。
1002
+
1003
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/utilities/to-refs/to-refs.uvue)
1004
+
1005
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/utilities/to-refs/to-refs
1006
+
1007
+ ```vue
1008
+ <template>
1009
+ <view class="page">
1010
+ <view class="flex justify-between flex-row mb-10">
1011
+ <text>state.num:</text>
1012
+ <text id="state-num">{{ state['num'] }}</text>
1013
+ </view>
1014
+ <view class="flex justify-between flex-row mb-10">
1015
+ <text>state.str:</text>
1016
+ <text id="state-str">{{ state['str'] }}</text>
1017
+ </view>
1018
+ <view class="flex justify-between flex-row mb-10">
1019
+ <text>stateAsRefs.num:</text>
1020
+ <text id="state-as-refs-num">{{ (stateAsRefs['num'] as Ref<number>).value }}</text>
1021
+ </view>
1022
+ <view class="flex justify-between flex-row mb-10">
1023
+ <text>stateAsRefs.str:</text>
1024
+ <text id="state-as-refs-str">{{ (stateAsRefs['str'] as Ref<string>).value }}</text>
1025
+ </view>
1026
+ <button class="mt-10" id="update-state-btn" @click="updateState">update state</button>
1027
+ </view>
1028
+ </template>
1029
+
1030
+
1031
+ ```
1032
+
1033
+ #### isProxy
1034
+
1035
+ 检查一个对象是否是由 [reactive()](#reactive)、[readonly()](#readonly)、[shallowReactive()](#shallowreactive) 或 [shallowReadonly()](#shallowreadonly) 创建的代理。
1036
+
1037
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/utilities/is-proxy/is-proxy.uvue)
1038
+
1039
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/utilities/is-proxy/is-proxy
1040
+
1041
+ ```vue
1042
+ <template>
1043
+ <view class="page">
1044
+ <view class="flex justify-between flex-row mb-10">
1045
+ <text>isProxy(count):</text>
1046
+ <text id="is-proxy-count">{{ isProxyCount }}</text>
1047
+ </view>
1048
+ <view class="flex justify-between flex-row mb-10">
1049
+ <text>isProxy(refCount):</text>
1050
+ <text id="is-proxy-ref-count">{{ isProxyRefCount }}</text>
1051
+ </view>
1052
+ <view class="flex justify-between flex-row mb-10">
1053
+ <text>isProxy(reactiveCount):</text>
1054
+ <text id="is-proxy-reactive-count">{{ isProxyReactiveCount }}</text>
1055
+ </view>
1056
+ <view class="flex justify-between flex-row mb-10">
1057
+ <text>isProxy(readonlyCount):</text>
1058
+ <text id="is-proxy-readonly-count">{{ isProxyReadonlyCount }}</text>
1059
+ </view>
1060
+ <view class="flex justify-between flex-row mb-10">
1061
+ <text>isProxy(shallowReactiveCount):</text>
1062
+ <text id="is-proxy-shallow-reactive-count">{{
1063
+ isProxyShallowReactiveCount
1064
+ }}</text>
1065
+ </view>
1066
+ <view class="flex justify-between flex-row mb-10">
1067
+ <text>isProxy(shallowReadonlyCount):</text>
1068
+ <text id="is-proxy-shallow-readonly-count">{{
1069
+ isProxyShallowReadonlyCount
1070
+ }}</text>
1071
+ </view>
1072
+ </view>
1073
+ </template>
1074
+
1075
+
1076
+
1077
+ ```
1078
+
1079
+ #### isReactive
1080
+
1081
+ 检查一个对象是否是由 [reactive()](#reactive) 或 [shallowReactive()](#shallowreactive) 创建的代理。
1082
+
1083
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/utilities/is-reactive/is-reactive.uvue)
1084
+
1085
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/utilities/is-reactive/is-reactive
1086
+
1087
+ ```vue
1088
+ <template>
1089
+ <view class="page">
1090
+ <view class="flex justify-between flex-row mb-10">
1091
+ <text>isReactive(count):</text>
1092
+ <text id="is-reactive-count">{{ isReactiveCount }}</text>
1093
+ </view>
1094
+ <view class="flex justify-between flex-row mb-10">
1095
+ <text>isReactive(count):</text>
1096
+ <text id="is-reactive-count">{{ isReactiveCount }}</text>
1097
+ </view>
1098
+ <view class="flex justify-between flex-row mb-10">
1099
+ <text>isReactive(refCount):</text>
1100
+ <text id="is-reactive-ref-count">{{ isReactiveRefCount }}</text>
1101
+ </view>
1102
+ <view class="flex justify-between flex-row mb-10">
1103
+ <text>isReactive(reactiveCount):</text>
1104
+ <text id="is-reactive-reactive-count">{{ isReactiveReactiveCount }}</text>
1105
+ </view>
1106
+ <view class="flex justify-between flex-row mb-10">
1107
+ <text>isReactive(readonlyCount):</text>
1108
+ <text id="is-reactive-readonly-count">{{ isReactiveReadonlyCount }}</text>
1109
+ </view>
1110
+ <view class="flex justify-between flex-row mb-10">
1111
+ <text>isReactive(shallowReactiveCount):</text>
1112
+ <text id="is-reactive-shallow-reactive-count">{{
1113
+ isReactiveShallowReactiveCount
1114
+ }}</text>
1115
+ </view>
1116
+ <view class="flex justify-between flex-row mb-10">
1117
+ <text>isReactive(shallowReadonlyCount):</text>
1118
+ <text id="is-reactive-shallow-readonly-count">{{
1119
+ isReactiveShallowReadonlyCount
1120
+ }}</text>
1121
+ </view>
1122
+ </view>
1123
+ </template>
1124
+
1125
+
1126
+
1127
+ ```
1128
+
1129
+ #### isReadonly
1130
+
1131
+ 检查传入的值是否为只读对象。只读对象的属性可以更改,但他们不能通过传入的对象直接赋值。
1132
+
1133
+ 通过 [readonly()](#readonly) 和 [shallowReadonly()](#shallowreadonly) 创建的代理都是只读的,因为他们是没有 set 函数的 [computed()](#computed) ref。
1134
+
1135
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/utilities/is-readonly/is-readonly.uvue)
1136
+
1137
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/utilities/is-readonly/is-readonly
1138
+
1139
+ ```vue
1140
+ <template>
1141
+ <view class="page">
1142
+ <view class="flex justify-between flex-row mb-10">
1143
+ <text>isReadonly(count):</text>
1144
+ <text id="is-readonly-count">{{ isReadonlyCount }}</text>
1145
+ </view>
1146
+ <view class="flex justify-between flex-row mb-10">
1147
+ <text>isReadonly(refCount):</text>
1148
+ <text id="is-readonly-ref-count">{{ isReadonlyRefCount }}</text>
1149
+ </view>
1150
+ <view class="flex justify-between flex-row mb-10">
1151
+ <text>isReadonly(reactiveCount):</text>
1152
+ <text id="is-readonly-reactive-count">{{ isReadonlyReactiveCount }}</text>
1153
+ </view>
1154
+ <view class="flex justify-between flex-row mb-10">
1155
+ <text>isReadonly(readonlyCount):</text>
1156
+ <text id="is-readonly-readonly-count">{{ isReadonlyReadonlyCount }}</text>
1157
+ </view>
1158
+ <view class="flex justify-between flex-row mb-10">
1159
+ <text>isReadonly(shallowReactiveCount):</text>
1160
+ <text id="is-readonly-shallow-reactive-count">{{
1161
+ isReadonlyShallowReactiveCount
1162
+ }}</text>
1163
+ </view>
1164
+ <view class="flex justify-between flex-row mb-10">
1165
+ <text>isReadonly(shallowReadonlyCount):</text>
1166
+ <text id="is-readonly-shallow-readonly-count">{{
1167
+ isReadonlyShallowReadonlyCount
1168
+ }}</text>
1169
+ </view>
1170
+ </view>
1171
+ </template>
1172
+
1173
+
1174
+ ```
1175
+
1176
+ ## 响应式: 进阶
1177
+
1178
+ | | 兼容性 |
1179
+ | :- | :- |
1180
+ | shallowRef() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1181
+ | triggerRef() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1182
+ | customRef() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1183
+ | shallowReactive() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1184
+ | shallowReadonly() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1185
+ | toRaw() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1186
+ | markRaw() | |
1187
+ | effectScope() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1188
+ | getCurrentScope() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1189
+ | onScopeDispose() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1190
+
1191
+ ### 示例代码 @example
1192
+
1193
+ #### customRef
1194
+
1195
+ 创建一个自定义的 ref,显式声明对其依赖追踪和更新触发的控制方式。
1196
+
1197
+ - 详细信息
1198
+
1199
+ `customRef()` 预期接收一个工厂函数作为参数,这个工厂函数接受 `track` 和 `trigger` 两个函数作为参数,并返回一个带有 get 和 set 方法的对象。
1200
+
1201
+ 一般来说,`track()` 应该在 `get()` 方法中调用,而 `trigger()` 应该在 `set()` 中调用。然而事实上,你对何时调用、是否应该调用他们有完全的控制权。
1202
+
1203
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/custom-ref/custom-ref.uvue)
1204
+
1205
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/custom-ref/custom-ref
1206
+
1207
+ ```vue
1208
+ <template>
1209
+ <view class="page">
1210
+ <view class="flex justify-between flex-row mb-10">
1211
+ <text>state.count:</text>
1212
+ <text id="state-count">{{ state['count'] }}</text>
1213
+ </view>
1214
+ <button class="mb-10 increment-btn" @click="increment">
1215
+ increment state.count
1216
+ </button>
1217
+ <button class="mb-10 trigger-ref-btn" @click="triggerRefState">
1218
+ triggerRef state
1219
+ </button>
1220
+ </view>
1221
+ </template>
1222
+
1223
+
1224
+
1225
+ ```
1226
+
1227
+ #### effectScope
1228
+
1229
+ 创建一个 effect 作用域,可以捕获其中所创建的响应式副作用 (即计算属性和侦听器),这样捕获到的副作用可以一起处理。对于该 API 的使用细节
1230
+
1231
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/effect-scope/effect-scope.uvue)
1232
+
1233
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/effect-scope/effect-scope
1234
+
1235
+ ```vue
1236
+ <template>
1237
+ <view class="page">
1238
+ <view class="flex justify-between flex-row mb-10">
1239
+ <text>counter:</text>
1240
+ <text id="counter">{{ counter }}</text>
1241
+ </view>
1242
+ <view class="flex justify-between flex-row mb-10">
1243
+ <text>watch counter result:</text>
1244
+ <text id="watch-counter-res">{{ watchCounterRes }}</text>
1245
+ </view>
1246
+ <view class="flex justify-between flex-row mb-10">
1247
+ <text>watchEffect counter result:</text>
1248
+ <text id="watch-effect-counter-res">{{ watchEffectCounterRes }}</text>
1249
+ </view>
1250
+ <button
1251
+ id="increment-counter-btn"
1252
+ class="mt-10"
1253
+ @click="
1254
+ () => {
1255
+ counter++;
1256
+ }
1257
+ ">
1258
+ increment counter
1259
+ </button>
1260
+ <button id="stop-effect-scope-btn" class="mt-10" @click="stopEffectScope">
1261
+ stop effect scope
1262
+ </button>
1263
+ </view>
1264
+ </template>
1265
+
1266
+
1267
+
1268
+ ```
1269
+
1270
+ #### getCurrentScope
1271
+
1272
+ 如果有的话,返回当前活跃的 effect 作用域。
1273
+
1274
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/get-current-scope/get-current-scope.uvue)
1275
+
1276
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/get-current-scope/get-current-scope
1277
+
1278
+ ```vue
1279
+ <template>
1280
+ <view class="page">
1281
+ <view class="flex justify-between flex-row mb-10">
1282
+ <text>hasCurrentScope:</text>
1283
+ <text id="has-current-scope">{{ hasCurrentScope }}</text>
1284
+ </view>
1285
+ <button id="create-scope-btn" class="mt-10" @click="createScope">
1286
+ create scope
1287
+ </button>
1288
+ </view>
1289
+ </template>
1290
+
1291
+ ```
1292
+
1293
+ #### onScopeDispose
1294
+
1295
+ 在当前活跃的 effect 作用域上注册一个处理回调函数。当相关的 effect 作用域停止时会调用这个回调函数。
1296
+
1297
+ 这个方法可以作为可复用的组合式函数中 `onUnmounted` 的替代品,它并不与组件耦合,因为每一个 Vue 组件的 `setup()` 函数也是在一个 effect 作用域中调用的。
1298
+
1299
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/on-scope-dispose/on-scope-dispose.uvue)
1300
+
1301
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/on-scope-dispose/on-scope-dispose
1302
+
1303
+ ```vue
1304
+ <template>
1305
+ <view class="page">
1306
+ <view class="flex justify-between flex-row mb-10">
1307
+ <text>hasCurrentScope:</text>
1308
+ <text id="has-current-scope">{{ hasCurrentScope }}</text>
1309
+ </view>
1310
+ <button id="create-scope-btn" class="mt-10" @click="createScope">
1311
+ create scope
1312
+ </button>
1313
+ <button id="stop-scope-btn" class="mt-10" @click="stopScope">
1314
+ stop scope
1315
+ </button>
1316
+ </view>
1317
+ </template>
1318
+
1319
+
1320
+
1321
+ ```
1322
+
1323
+ #### shallowReactive
1324
+
1325
+ [reactive()](#reactive) 的浅层作用形式。
1326
+
1327
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/shallow-reactive/shallow-reactive.uvue)
1328
+
1329
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/shallow-reactive/shallow-reactive
1330
+
1331
+ ```vue
1332
+ <template>
1333
+ <view class="page">
1334
+ <view class="flex justify-between flex-row mb-10">
1335
+ <text>state.count:</text>
1336
+ <text id="state-count">{{ state.count }}</text>
1337
+ </view>
1338
+ <view class="flex justify-between flex-row mb-10">
1339
+ <text>state.nested.count:</text>
1340
+ <text id="state-nested-count">{{ state.nested.count }}</text>
1341
+ </view>
1342
+ <button
1343
+ id="increment-state-count-btn"
1344
+ class="mb-10"
1345
+ @click="incrementStateCount">
1346
+ increment state.count
1347
+ </button>
1348
+ <button
1349
+ id="increment-state-nested-count-btn"
1350
+ @click="incrementStateNestedCount">
1351
+ increment state.nested.count
1352
+ </button>
1353
+ </view>
1354
+ </template>
1355
+
1356
+
1357
+
1358
+ ```
1359
+
1360
+ #### shallowReadonly
1361
+
1362
+ [readonly()](#readonly) 的浅层作用形式
1363
+
1364
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/shallow-readonly/shallow-readonly.uvue)
1365
+
1366
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/shallow-readonly/shallow-readonly
1367
+
1368
+ ```vue
1369
+ <template>
1370
+ <view :key="pageKey" class="page">
1371
+ <view class="flex justify-between flex-row mb-10">
1372
+ <text>state.count:</text>
1373
+ <text id="state-count">{{ state.count }}</text>
1374
+ </view>
1375
+ <view class="flex justify-between flex-row mb-10">
1376
+ <text>state.nested.count:</text>
1377
+ <text id="state-nested-count">{{ state.nested.count }}</text>
1378
+ </view>
1379
+ <button
1380
+ id="increment-state-count-btn"
1381
+ class="mb-10"
1382
+ @click="incrementStateCount">
1383
+ increment state.count
1384
+ </button>
1385
+ <button
1386
+ id="increment-state-nested-count-btn"
1387
+ class="mb-10"
1388
+ @click="incrementStateNestedCount">
1389
+ increment state.nested.count
1390
+ </button>
1391
+
1392
+ <button id="update-page-render-btn" @click="updatePageRender">
1393
+ update page render
1394
+ </button>
1395
+
1396
+ </view>
1397
+ </template>
1398
+
1399
+
1400
+
1401
+ ```
1402
+
1403
+ #### shallowRef
1404
+
1405
+ [ref()](#ref) 的浅层作用形式。
1406
+
1407
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/shallow-ref/shallow-ref.uvue)
1408
+
1409
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/shallow-ref/shallow-ref
1410
+
1411
+ ```vue
1412
+ <template>
1413
+ <view class="page">
1414
+ <view class="flex justify-between flex-row mb-10">
1415
+ <text>state.count:</text>
1416
+ <text id="state-count">{{ state.count }}</text>
1417
+ </view>
1418
+ <button
1419
+ id="increment-state-count-btn"
1420
+ class="mb-10"
1421
+ @click="incrementStateCount">
1422
+ increment state.count
1423
+ </button>
1424
+ <button id="update-state-btn" @click="updateState">update state</button>
1425
+ </view>
1426
+ </template>
1427
+
1428
+
1429
+
1430
+ ```
1431
+
1432
+ #### toRaw
1433
+
1434
+ 根据一个 Vue 创建的代理返回其原始对象。
1435
+
1436
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/to-raw/to-raw.uvue)
1437
+
1438
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/to-raw/to-raw
1439
+
1440
+ ```vue
1441
+ <template>
1442
+ <view class="page">
1443
+ <view class="flex justify-between flex-row mb-10">
1444
+ <text>check toRaw ref:</text>
1445
+ <text id="check-to-raw-ref">{{ checkToRawRef }}</text>
1446
+ </view>
1447
+ <view class="flex justify-between flex-row mb-10">
1448
+ <text>check toRaw reactive:</text>
1449
+ <text id="check-to-raw-reactive">{{ checkToRawReactive }}</text>
1450
+ </view>
1451
+ <view class="flex justify-between flex-row mb-10">
1452
+ <text>check toRaw readonly:</text>
1453
+ <text id="check-to-raw-readonly">{{ checkToRawReadonly }}</text>
1454
+ </view>
1455
+ <view class="flex justify-between flex-row mb-10">
1456
+ <text>check toRaw shallowReactive:</text>
1457
+ <text id="check-to-raw-shallow-reactive">{{
1458
+ checkToRawShallowReactive
1459
+ }}</text>
1460
+ </view>
1461
+ <view class="flex justify-between flex-row mb-10">
1462
+ <text>check toRaw shallowReadonly:</text>
1463
+ <text id="check-to-raw-shallow-readonly">{{
1464
+ checkToRawShallowReadonly
1465
+ }}</text>
1466
+ </view>
1467
+ </view>
1468
+ </template>
1469
+
1470
+
1471
+
1472
+ ```
1473
+
1474
+ #### triggerRef
1475
+
1476
+ 强制触发依赖于一个[浅层 ref](#shallowref) 的副作用,这通常在对浅引用的内部值进行深度变更后使用。
1477
+
1478
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/reactivity/advanced/trigger-ref/trigger-ref.uvue)
1479
+
1480
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/reactivity/advanced/trigger-ref/trigger-ref
1481
+
1482
+ ```vue
1483
+ <template>
1484
+ <view class="page">
1485
+ <view class="flex justify-between flex-row mb-10">
1486
+ <text>state.count:</text>
1487
+ <text id="state-count">{{ state.count }}</text>
1488
+ </view>
1489
+ <button
1490
+ id="increment-state-count-btn"
1491
+ class="mb-10"
1492
+ @click="incrementStateCount">
1493
+ increment state.count
1494
+ </button>
1495
+ <button id="trigger-ref-state-btn" @click="triggerRefState">
1496
+ trigger state
1497
+ </button>
1498
+ </view>
1499
+ </template>
1500
+
1501
+
1502
+
1503
+ ```
1504
+
1505
+ ## 组合选项 @options-composition
1506
+
1507
+ | | Web | 微信小程序 | Android(VDOM) | Android(Vapor) | iOS(VDOM) | iOS(Vapor) | HarmonyOS(VDOM) | HarmonyOS(Vapor) |
1508
+ | :- | :- | :- | :- | :- | :- | :- | :- | :- |
1509
+ | provide | 4.0 | 4.41 | 3.99 | 5.21 | 4.11 | 5.11 | 4.61 | 5.0 |
1510
+ | inject | 4.0 | 4.41 | 3.99 | 5.21 | 4.11 | 5.11 | 4.61 | 5.0 |
1511
+ | mixins | 4.0 | 4.41 | 3.99 | x | 4.11 | x | 4.61 | x |
1512
+
1513
+ ### inject
1514
+
1515
+ 当使用 `inject` 声明从上层提供方注入的属性时,支持两种写法:字符串数组和对象。推荐使用对象写法,因为当使用数组方法时,类型会被推导为 `any | null` 类型。\
1516
+ 使用对象写法时,额外增加 `type` 属性用于标记类型。如果注入的属性类型不是基础数据类型,需要通过 `PropType` 来标记类型:
1517
+
1518
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/component-instance/inject/inject-composition.uvue)
1519
+
1520
+ ::: preview
1521
+
1522
+ ```vue
1523
+ <template>
1524
+ <view>
1525
+ <text>inject page</text>
1526
+ <text class="mt-10 msg">msg: {{msg}}</text>
1527
+ <text class="mt-10 num">num: {{num}}</text>
1528
+ <text class="mt-10 obj">obj: {{JSON.stringify(obj)}}</text>
1529
+ <text class="mt-10 arr">arr: {{JSON.stringify(arr)}}</text>
1530
+ <text class="mt-10 arr-0">arr[0]: {{ arr[0]}}</text>
1531
+ <text class="mt-10 fn">fn: {{fnRes}}</text>
1532
+ <text class="mt-10 fn">notFoundWithWarning: {{notFoundWithWarning}}</text>
1533
+ <text class="mt-10 fn">notFoundWithDefaultValue: {{notFoundWithDefaultValue}}</text>
1534
+ <text class="mt-10 has-injection-context">hasInjectionContext:
1535
+ {{checkHasInjectionContextRes}}</text>
1536
+ <button class="mt-10 check-has-injection-context-btn" @click="checkHasInjectionContext">check
1537
+ hasInjectionContext</button>
1538
+ </view>
1539
+ </template>
1540
+
1541
+
1542
+ ```
1543
+
1544
+ ## 通用
1545
+
1546
+ ### getCurrentInstance
1547
+
1548
+ 访问内部组件实例。
1549
+
1550
+ ::: warning 注意
1551
+ - `getCurrentInstance` 只能在 setup 或生命周期钩子中调用。
1552
+ - 在 `app` 端 `proxy` 属性可能为空,需使用 `!` 非空断言操作符。
1553
+
1554
+ ```uts
1555
+
1556
+ ```
1557
+
1558
+ ## 生命周期钩子 @lifecycle-composition
1559
+
1560
+ > [页面及组件生命周期流程图](../page.md#lifecycleflow)
1561
+
1562
+ ### 页面生命周期 @page-lifecycle-composition
1563
+
1564
+ #### 兼容性 @page-lifecycle-compatibility
1565
+
1566
+ [页面生命周期](../page.md#lifecycle)
1567
+
1568
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/lifecycle/page/page-composition.uvue)
1569
+
1570
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/lifecycle/page/page-composition
1571
+
1572
+ ```vue
1573
+ <template>
1574
+
1575
+ <scroll-view style="flex: 1" :bounces="false">
1576
+
1577
+ <view class="page container">
1578
+ <text>page lifecycle 组合式 API</text>
1579
+ <view class="flex flex-row justify-between mt-10">
1580
+ <text>onLoad 触发:</text>
1581
+ <text>{{ isOnloadTriggered }}</text>
1582
+ </view>
1583
+ <view class="flex flex-row justify-between mt-10">
1584
+ <text>onPageShow 触发:</text>
1585
+ <text>{{ isOnPageShowTriggered }}</text>
1586
+ </view>
1587
+ <view class="flex flex-row justify-between mt-10">
1588
+ <text>onReady 触发:</text>
1589
+ <text>{{ isOnReadyTriggered }}</text>
1590
+ </view>
1591
+ <view class="flex flex-row justify-between mt-10">
1592
+ <text>onPullDownRefresh 触发:</text>
1593
+ <text>{{ isOnPullDownRefreshTriggered }}</text>
1594
+ </view>
1595
+ <view class="flex flex-row justify-between mt-10">
1596
+ <text>onPageScroll 触发:</text>
1597
+ <text>{{ isOnPageScrollTriggered }}</text>
1598
+ </view>
1599
+ <view class="flex flex-row justify-between mt-10">
1600
+ <text>onReachBottom 触发:</text>
1601
+ <text>{{ isOnReachBottomTriggered }}</text>
1602
+ </view>
1603
+ <view class="flex flex-row justify-between mt-10">
1604
+ <text>onBackPress 触发:</text>
1605
+ <text>{{ isOnBackPressTriggered }}</text>
1606
+ </view>
1607
+ <view class="flex flex-row justify-between mt-10">
1608
+ <text>onPageHide 触发:</text>
1609
+ <text>{{ isOnPageHideTriggered }}</text>
1610
+ </view>
1611
+ <view class="flex flex-row justify-between mt-10">
1612
+ <text>onResize 触发:</text>
1613
+ <text>{{ isOnResizeTriggered }}</text>
1614
+ </view>
1615
+ <view class="mt-10">
1616
+ <MonitorAppLifecycleComposition class="monitor-app-lifecycle" />
1617
+ </view>
1618
+ <view class="mt-10">
1619
+ <MonitorPageLifecycleComposition />
1620
+ </view>
1621
+ <button class="mt-10" @click="scrollToBottom">scrollToBottom</button>
1622
+ <button class="mt-10" @click="pullDownRefresh">
1623
+ trigger pullDownRefresh
1624
+ </button>
1625
+
1626
+ <button class="mt-10" @click="openLifecycleDialogPage">
1627
+ openDialogPage
1628
+ </button>
1629
+ <button class="mt-10" @click="closeLifecycleDialogPage">
1630
+ closeDialogPage
1631
+ </button>
1632
+
1633
+ <button class="mt-10" @click="goOnBackPress">
1634
+ 跳转 onBackPress 示例
1635
+ </button>
1636
+ </view>
1637
+
1638
+ </scroll-view>
1639
+
1640
+ </template>
1641
+
1642
+
1643
+
1644
+ <style>
1645
+ .container {
1646
+ height: 2200px;
1647
+ }
1648
+ </style>
1649
+
1650
+ ```
1651
+
1652
+ ### 组件生命周期 @page-component-composition
1653
+
1654
+ #### 兼容性 @component-lifecycle-compatibility
1655
+
1656
+ | | 兼容性 | 描述 |
1657
+ | :- | :- | :- |
1658
+ | onMounted() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 | el 被新创建的 vm.$el 替换,并挂载到实例上去之后调用该钩子。<br/>如果 root 实例挂载了一个文档内元素,当 mounted 被调用时 vm.$el 也在文档内。 |
1659
+ | onUpdated() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 | 由于数据更改导致的虚拟 DOM 重新渲染和打补丁,在这之后会调用该钩子。 |
1660
+ | onUnmounted() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 | 在一个组件实例被卸载之后调用。 |
1661
+ | onBeforeMount() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 | 在挂载开始之前被调用:相关的 render 函数首次被调用。 |
1662
+ | onBeforeUpdate() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 | 数据更新时调用,发生在虚拟 DOM 打补丁之前。<br/>这里适合在更新之前访问现有的 DOM,比如手动移除已添加的事件监听器。 |
1663
+ | onBeforeUnmount() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 | 在一个组件实例被卸载之前调用。 |
1664
+ | onErrorCaptured() | Web x / 微信小程序 x / Android x / iOS x / HarmonyOS x(部分支持,见上) | 注册一个钩子,在捕获了后代组件传递的错误时调用。 |
1665
+ | onRenderTracked() | Web x / 微信小程序 - / Android x / iOS x / HarmonyOS x(部分支持,见上) | 注册一个调试钩子,当组件渲染过程中追踪到响应式依赖时调用。 |
1666
+ | onRenderTriggered() | Web x / 微信小程序 x / Android x / iOS x / HarmonyOS x(部分支持,见上) | 注册一个调试钩子,当响应式依赖的变更触发了组件渲染时调用。 |
1667
+ | onActivated() | Web 4.0 / 微信小程序 x / Android x / iOS x / HarmonyOS x(部分支持,见上) | keep-alive 组件激活时调用。 |
1668
+ | onDeactivated() | Web 4.0 / 微信小程序 x / Android x / iOS x / HarmonyOS x(部分支持,见上) | keep-alive 组件停用时调用。 |
1669
+ | onServerPrefetch() | Web x / 微信小程序 x / Android x / iOS x / HarmonyOS x(部分支持,见上) | 注册一个异步函数,在组件实例在服务器上被渲染之前调用。<br/>如果这个钩子返回了一个 Promise,服务端渲染会在渲染该组件前等待该 Promise 完成。<br/>这个钩子仅会在服务端渲染中执行,可以用于执行一些仅存在于服务端的数据抓取过程。 |
1670
+ | onRecycle() | Web x / 微信小程序 x / Android(VDOM) x / Android(Vapor) 5.21 / iOS(VDOM) x / iOS(Vapor) 5.11 / HarmonyOS(VDOM) x / HarmonyOS(Vapor) 5.0(部分支持,见上) | 组件回收时的生命周期钩子 |
1671
+ | onReuse() | Web x / 微信小程序 x / Android(VDOM) x / Android(Vapor) 5.21 / iOS(VDOM) x / iOS(Vapor) 5.11 / HarmonyOS(VDOM) x / HarmonyOS(Vapor) 5.0(部分支持,见上) | 组件复用时的生命周期钩子 |
1672
+ | onLoad() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS 4.11 / HarmonyOS 4.61 | 生命周期回调 监听页面加载<br/><br/>页面加载时触发。一个页面只会调用一次,可以在 onLoad 的参数中获取打开当前页面路径中的参数。 |
1673
+ | onReady() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS 4.11 / HarmonyOS 4.61 | 生命周期回调 监听页面初次渲染完成<br/><br/>页面初次渲染完成时触发。一个页面只会调用一次,代表页面已经准备妥当,可以和视图层进行交互。<br/> |
1674
+ | onUnload() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS 4.11 / HarmonyOS 4.61 | 生命周期回调 监听页面卸载<br/><br/>页面卸载时触发。如 `redirectTo` 或 `navigateBack` 到其他页面时。<br/> |
1675
+ | onPageShow() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS 4.11 / HarmonyOS 4.61 | 生命周期回调 监听页面显示<br/><br/>页面显示/切入前台时触发。<br/> |
1676
+ | onPageHide() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS 4.11 / HarmonyOS 4.61 | 生命周期回调 监听页面隐藏<br/><br/>页面隐藏/切入后台时触发。 如 `navigateTo` 或底部 `tab` 切换到其他页面,应用切入后台等。<br/> |
1677
+ | onPageScroll() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS(VDOM) 4.13 / iOS(Vapor) 5.21 / HarmonyOS(VDOM) 4.61 / HarmonyOS(Vapor) 5.08 | 页面滚动触发事件的处理函数<br/><br/>监听用户滑动页面事件。 |
1678
+ | onBackPress() | Web 4.0 / 微信小程序 x / Android 3.9 / iOS 4.11 / HarmonyOS 4.61(部分支持,见上) | 监听页面返回 |
1679
+ | onReachBottom() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS 4.11 / HarmonyOS(VDOM) 4.61 / HarmonyOS(Vapor) 5.08 | 页面上拉触底事件的处理函数<br/>- 可以在 `pages.json` 的页面配置中设置触发距离 `onReachBottomDistance` 。<br/>- 在触发距离内滑动期间,本事件只会被触发一次。<br/> |
1680
+ | onPullDownRefresh() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS(VDOM) 4.11 / iOS(Vapor) 5.21 / HarmonyOS(VDOM) 4.61 / HarmonyOS(Vapor) 5.21 | 监听用户下拉动作<br/>- 需要在 `pages.json` 的页面配置中开启 `enablePullDownRefresh` 。<br/>- 可以通过 `uni.startPullDownRefresh` 触发下拉刷新,调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。<br/>- 当处理完数据刷新后,`uni.stopPullDownRefresh` 可以停止当前页面的下拉刷新。<br/> |
1681
+ | onResize() | Web 4.0 / 微信小程序 4.41 / Android 3.9 / iOS 4.11 / HarmonyOS 4.61 | 页面尺寸改变时触发 |
1682
+
1683
+ #### onMounted、onUnmounted 使用注意事项 @mounted-unmounted-tips
1684
+
1685
+ 目前 App平台 onMounted、onUnmounted 可以保证当前数据已经同步到 DOM,但是由于排版和渲染是异步的,所以 onMounted、onUnmounted 不能保证 DOM 排版以及渲染完毕。\
1686
+ 如果需要获取排版后的节点信息推荐使用 [uni.createSelectorQuery](../api/nodes-info.md) 不推荐直接使用 [Element](../dom/unielement.md) 对象。\
1687
+ 在修改 DOM 后,立刻使用 [Element](../dom/unielement.md) 对象的同步接口获取 DOM 状态可能获取到的是排版之前的,而 [uni.createSelectorQuery](../api/nodes-info.md) 可以保障获取到的节点信息是排版之后的。
1688
+
1689
+ 注:页面的 onReady 生命周期可以获取到排版后的节点信息
1690
+
1691
+ #### onActivated、onDeactivated 使用注意事项 @activated-deactivated-tips
1692
+
1693
+ 当 A 页面存在 `keepAlive` 组件,A 页面 `navigateTo` B 页面时
1694
+ - Web 端 A 页面中 `keepAlive` 的组件会触发 `onDeactivated` 生命周期
1695
+ - App 端 A 页面中 `keepAlive` 的组件不会触发 `onDeactivated` 生命周期
1696
+
1697
+ 当 B 页面 back 返回 A 页面时
1698
+ - Web 端 A 页面中 `keepAlive` 的组件会触发 `onActivated` 生命周期
1699
+ - App 端 A 页面中 `keepAlive` 的组件不会触发 `onActivated` 生命周期
1700
+
1701
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/lifecycle/component/ChildComponentComposition.uvue)
1702
+
1703
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/lifecycle/component/ChildComponentComposition
1704
+
1705
+ ```vue
1706
+ <template>
1707
+
1708
+ title: {{ title }}
1709
+
1710
+
1711
+ <text>title: {{ title }}</text>
1712
+
1713
+ <button class="component-lifecycle-btn mt-10" @click="updateTitle">
1714
+ updateTitle
1715
+ </button>
1716
+ </template>
1717
+
1718
+
1719
+
1720
+ ```
1721
+
1722
+ ## \
1723
+ ```
1724
+
1725
+ ##### 兼容性
1726
+ | Web | 微信小程序 | Android | iOS | HarmonyOS |
1727
+ | :- | :- | :- | :- | :- |
1728
+ | 4.0 | √ | 3.9 | 4.11 | 4.61 |
1729
+
1730
+ ##### 属性
1731
+ | 名称 | 类型 | 兼容性 |
1732
+ | :- | :- | :-: |
1733
+ | setup | Any | Web 4.0 / 微信小程序 √ / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1734
+ | lang | Any | Web 4.0 / 微信小程序 √ / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1735
+ | 合法值 | 兼容性 | 描述 |
1736
+ | :- | :-: | :- |
1737
+ | ts | Web x / 微信小程序 √ / Android x / iOS x / HarmonyOS x(部分支持,见上) | typescript |
1738
+ | uts | Web 4.0 / 微信小程序 √ / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 | uts |
1739
+
1740
+ ##### 参见
1741
+
1742
+ ### 示例 @example
1743
+
1744
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/component-instance/setup-function/setup-function.uvue)
1745
+
1746
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/component-instance/setup-function/setup-function
1747
+
1748
+ ```vue
1749
+ <template>
1750
+
1751
+ <scroll-view style="flex: 1">
1752
+
1753
+ <view class="page">
1754
+ <view class="flex justify-between flex-row mt-10">
1755
+ <text>str:</text>
1756
+ <text id="str">{{ str }}</text>
1757
+ </view>
1758
+ <view class="flex justify-between flex-row mt-10">
1759
+ <text>num:</text>
1760
+ <text id="num">{{ num }}</text>
1761
+ </view>
1762
+ <view class="flex justify-between flex-row mt-10">
1763
+ <text>bool:</text>
1764
+ <text id="bool">{{ bool }}</text>
1765
+ </view>
1766
+ <view class="flex justify-between flex-row mt-10">
1767
+ <text>count:</text>
1768
+ <text id="count">{{ count }}</text>
1769
+ </view>
1770
+ <button class="mt-10" id="increment-btn" @click="increment">
1771
+ increment count
1772
+ </button>
1773
+ <view class="flex justify-between flex-row mt-10">
1774
+ <text>obj.str:</text>
1775
+ <text id="obj-str">{{ obj['str'] }}</text>
1776
+ </view>
1777
+ <view class="flex justify-between flex-row mt-10">
1778
+ <text>obj.num:</text>
1779
+ <text id="obj-num">{{ obj['num'] }}</text>
1780
+ </view>
1781
+ <view class="flex justify-between flex-row mt-10">
1782
+ <text>obj.bool:</text>
1783
+ <text id="obj-bool">{{ obj['bool'] }}</text>
1784
+ </view>
1785
+ <button class="mt-10" id="update-obj-btn" @click="updateObj">
1786
+ update obj
1787
+ </button>
1788
+
1789
+ <RenderFunction
1790
+ :str="str"
1791
+ :count="count"
1792
+ :obj="obj"
1793
+ @compUpdateObj="compUpdateObj"
1794
+ :isShow="true" />
1795
+
1796
+ <Foo id="component-foo">
1797
+ <text class="mt-10" id="default-slot-in-foo">default slot in Foo</text>
1798
+ </Foo>
1799
+ </view>
1800
+
1801
+ </scroll-view>
1802
+
1803
+ </template>
1804
+
1805
+ ```
1806
+
1807
+ ## 单文件组件中方法兼容性 @single-file-component-script-methods
1808
+
1809
+ | | 兼容性 |
1810
+ | :- | :- |
1811
+ | defineProps() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1812
+ | defineEmits() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1813
+ | defineModel() | Web 4.11 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1814
+ | defineExpose() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1815
+ | defineOptions() | Web 4.11 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1816
+ | defineSlots() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1817
+ | useSlots() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1818
+ | useAttrs() | Web 4.0 / 微信小程序 4.41 / Android 4.0 / iOS 4.11 / HarmonyOS 4.61 |
1819
+ | useRecycleState() | Web x / 微信小程序 x / Android(VDOM) x / Android(Vapor) 5.21 / iOS(VDOM) x / iOS(Vapor) 5.11 / HarmonyOS(VDOM) x / HarmonyOS(Vapor) 5.0(部分支持,见上) |
1820
+
1821
+ ### defineProps()
1822
+
1823
+ 仅支持数组字面量、对象字面量定义(等同于 `options` 中的 `props`规则)及使用纯类型参数的方式来声明。
1824
+
1825
+ #### 示例
1826
+
1827
+ [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/component-instance/props/props-composition.uvue)
1828
+
1829
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/component-instance/props/props-composition
1830
+
1831
+ ```vue
1832
+ <template>
1833
+ <view class="page">
1834
+ <array-literal class="array-literal-component" :str="str" :num="num" :bool="bool" :obj="obj" :arr="arr" />
1835
+ <object-type class="object-type-component" str="str" :num="num" :bool="bool" :obj="obj" :arr="arr" />
1836
+ <same-name-prop-default-value class="same-name-prop-default-value-component" />
1837
+ <props-with-defaults class="props-with-defaults-component" />
1838
+
1839
+ <reference-types class="reference-types-component" :list="[1,2,3]" />
1840
+
1841
+
1842
+ <reference-types class="reference-types-component" :list="['a','b','c']" />
1843
+
1844
+ </view>
1845
+ </template>
1846
+
1847
+
1848
+
1849
+ ```
1850
+
1851
+ ### defineEmits()
1852
+
1853
+ 仅支持数组字面量和纯类型参数的方式来声明。
1854
+
1855
+ ```ts
1856
+ // 数组字面量
1857
+ const emit = defineEmits(['change'])
1858
+
1859
+ // 纯类型参数
1860
+ const emit = defineEmits<{
1861
+ (e : 'change', id : number) : void
1862
+ }>()
1863
+ const emit = defineEmits<{
1864
+ // 具名元组语法
1865
+ change : [id: number]
1866
+ }>()
1867
+
1868
+ ```
1869
+
1870
+ #### 示例
1871
+
1872
+ [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/component-instance/emit-function/emit-function-composition.uvue)
1873
+
1874
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/component-instance/emit-function/emit-function-composition
1875
+
1876
+ ```vue
1877
+ <template>
1878
+ <view>
1879
+ <button @click="click" class="call-parent-btn">调用父组件事件</button>
1880
+ </view>
1881
+ </template>
1882
+
1883
+ ```
1884
+
1885
+ ### defineOptions()
1886
+
1887
+ 仅支持对象字面量方式定义。
1888
+
1889
+ ```ts
1890
+ defineOptions({
1891
+ data() {
1892
+ return {
1893
+ count: 0,
1894
+ price: 10,
1895
+ total: 0
1896
+ }
1897
+ },
1898
+ computed: {
1899
+ doubleCount() : number {
1900
+ return this.count * 2
1901
+ },
1902
+ },
1903
+ watch: {
1904
+ count() {
1905
+ this.total = this.price * this.count
1906
+ },
1907
+ },
1908
+ methods: {
1909
+ increment() {
1910
+ this.count++
1911
+ }
1912
+ }
1913
+ })
1914
+ ```
1915
+
1916
+ #### 示例
1917
+
1918
+ [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/component-instance/options/options-composition.uvue)
1919
+
1920
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/component-instance/options/options-composition
1921
+
1922
+ ```vue
1923
+ <template>
1924
+ <view class="page">
1925
+ <view class="mb-10 flex justify-between flex-row">
1926
+ <text>component name: </text>
1927
+ <text id="component-name">{{ dataInfo.name }}</text>
1928
+ </view>
1929
+
1930
+ <view class="mb-10 flex justify-between flex-row">
1931
+ <text>custom key: </text>
1932
+ <text id="custom-key">{{ dataInfo.customKey }}</text>
1933
+ </view>
1934
+
1935
+ <view class="mb-10 flex justify-between flex-row">
1936
+ <text>mixin data str: </text>
1937
+ <text id="mixin-data-str">{{ dataInfo.mixinDataStr }}</text>
1938
+ </view>
1939
+
1940
+
1941
+ </view>
1942
+ </template>
1943
+
1944
+
1945
+
1946
+ ```
1947
+
1948
+ ### defineExpose()
1949
+
1950
+ 使用 `
1951
+
1952
+ ```
1953
+
1954
+ ### defineModel()
1955
+
1956
+ 这个宏可以用来声明一个双向绑定 prop,通过父组件的 `v-model` 来使用。组件 [v-model](./built-in.md#v-model) 指南中也讨论了示例用法。
1957
+
1958
+ 在底层,这个宏声明了一个 model prop 和一个相应的值更新事件。如果第一个参数是一个字符串字面量,它将被用作 prop 名称;否则,prop 名称将默认为 `"modelValue"`。在这两种情况下,你都可以再传递一个额外的对象,它可以包含 prop 的选项和 model ref 的值转换选项。
1959
+
1960
+ **注意:** android 端 `defineModel` 暂不支持创建 `Array` 类型 `prop`。
1961
+
1962
+ #### 示例
1963
+
1964
+ [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/directive/v-model/Foo-composition.uvue)
1965
+
1966
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/directive/v-model/v-model-composition
1967
+
1968
+ ```vue
1969
+ <template>
1970
+ <view>
1971
+ <view class="mb-10 flex justify-between flex-row">
1972
+ <text>v-model in Foo:</text>
1973
+ <text id="model-value-text">{{ modelValue }}</text>
1974
+ </view>
1975
+ <view class="mb-10 flex justify-between flex-row">
1976
+ <text>v-model:msg in Foo:</text>
1977
+ <text id="model-msg-text">{{ msg }}</text>
1978
+ </view>
1979
+ <view class="mb-10 flex justify-between flex-row">
1980
+ <text>defineModel num:</text>
1981
+ <text id="model-num-text">{{ num }}</text>
1982
+ </view>
1983
+ <view class="mb-10 flex justify-between flex-row">
1984
+ <text>defineModel strArr:</text>
1985
+ <text id="model-str-arr-text">{{ JSON.stringify(strArr) }}</text>
1986
+ </view>
1987
+ <view class="mb-10 flex justify-between flex-row">
1988
+ <text>defineModel numArr:</text>
1989
+ <text id="model-num-arr-text">{{ JSON.stringify(numArr) }}</text>
1990
+ </view>
1991
+ <view class="mb-10 flex justify-between flex-row">
1992
+ <text>defineModel utsObj.value:</text>
1993
+ <text id="model-uts-obj-value-text">{{ utsObjModelValue }}</text>
1994
+ </view>
1995
+ <view class="mb-10 flex justify-between flex-row">
1996
+ <text>defineModel typeObj.value:</text>
1997
+ <text id="model-type-obj-value-text">{{ typeObjModelValue }}</text>
1998
+ </view>
1999
+ <button class="mb-10" id="update-value-btn" @click="updateValue">
2000
+ update value
2001
+ </button>
2002
+ </view>
2003
+ </template>
2004
+
2005
+ ```
2006
+
2007
+ ### defineSlots()
2008
+
2009
+ 这个宏可以用于为 IDE 提供插槽名称和 props 类型检查的类型提示。
2010
+
2011
+ `defineSlots()` 只接受类型参数,没有运行时参数。类型参数应该是一个类型字面量,其中属性键是插槽名称,值类型是插槽函数。函数的第一个参数是插槽期望接收的 props,其类型将用于模板中的插槽 props。返回类型目前被忽略,可以是 `any`,但我们将来可能会利用它来检查插槽内容。
2012
+
2013
+ 它还返回 `slots` 对象,该对象等同于在 setup 上下文中暴露或由 `useSlots()` 返回的 `slots` 对象。
2014
+
2015
+ #### 示例
2016
+
2017
+ [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/directive/v-slot/Foo-composition.uvue)
2018
+
2019
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/directive/v-slot/v-slot-composition
2020
+
2021
+ ```vue
2022
+ <template>
2023
+ <view>
2024
+ <slot name="header" :msg="msg"></slot>
2025
+ <slot :num="num"></slot>
2026
+ <slot name="num1" :num="num"></slot>
2027
+ <slot name="num2" :num="num"></slot>
2028
+ <slot name="msgTrue" :msg="msg"></slot>
2029
+ <slot name="msgFalse" :msg="msg"></slot>
2030
+ <slot name="footer" :arr="arr"></slot>
2031
+ <template v-for="item in 2">
2032
+ <slot name="withFor" :item="item"></slot>
2033
+ </template>
2034
+ </view>
2035
+ </template>
2036
+
2037
+ ```
2038
+
2039
+ ### useSlots() 和 useAttrs()
2040
+
2041
+ 在 `
2042
+ ```
2043
+
2044
+ #### useAttrs() 示例 @useattrs-example
2045
+
2046
+ [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/component-instance/attrs/child-composition.uvue)
2047
+
2048
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/component-instance/attrs/attrs-composition
2049
+
2050
+ ```vue
2051
+ <template>
2052
+ <view>
2053
+ <view class="mb-10 flex flex-row justify-between">
2054
+ <text>hasPropsAttr</text>
2055
+ <text id="has-props-attr">{{ hasPropsAttr }}</text>
2056
+ </view>
2057
+ <view class="mb-10 flex flex-row justify-between">
2058
+ <text>hasEmitsAttr</text>
2059
+ <text id="has-emits-attr">{{ hasEmitsAttr }}</text>
2060
+ </view>
2061
+ <view class="mb-10 flex flex-row justify-between">
2062
+ <text>hasClassAttr</text>
2063
+ <text id="has-class-attr">{{ hasClassAttr }}</text>
2064
+ </view>
2065
+ <view class="mb-10 flex flex-row justify-between">
2066
+ <text>hasStyleAttr</text>
2067
+ <text id="has-class-attr">{{ hasStyleAttr }}</text>
2068
+ </view>
2069
+ </view>
2070
+ </template>
2071
+
2072
+ ```
2073
+
2074
+ ### useComputedStyle() @use-computed-style
2075
+
2076
+ 获取组件根节点的计算样式。useComputedStyle返回一个响应式的map,开发者可以通过map的get方法获取对应的样式值。[详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/helpers/useComputedStyle/CompUseComputedStyle.uvue)
2077
+
2078
+ 类型定义:
2079
+
2080
+ ```ts
2081
+ type UseComputedStyleOptions = {
2082
+ /**
2083
+ * 需要监听的样式属性列表
2084
+ */
2085
+ properties?: string[] | null;
2086
+ /**
2087
+ * 是否从原根节点过滤 properties 中的属性,默认过滤
2088
+ * @default true
2089
+ */
2090
+ filterProperties?: boolean | null;
2091
+ };
2092
+ declare function useComputedStyle(options: UseComputedStyleOptions | null): Map<string, string>;
2093
+ ```
2094
+
2095
+ ::: preview
2096
+
2097
+ ```vue
2098
+ <template>
2099
+ <view>
2100
+ <text :style="{ 'font-size': style.get('font-size'), color: style.get('color') }" style="line-height: 100px;">hello world</text>
2101
+ </view>
2102
+ </template>
2103
+
2104
+
2105
+
2106
+ <style></style>
2107
+ ```
2108
+
2109
+ ### useRecycleState() @use-recycle-state
2110
+
2111
+ 组件回收复用时状态存储工具方法
2112
+
2113
+ ### withDefaults()
2114
+
2115
+ 在组合式 API 中使用响应式 Props 解构时,需要使用 `withDefaults` 编译器宏。
2116
+
2117
+ ```ts
2118
+ interface Props {
2119
+ msg: string
2120
+ labels : string[]
2121
+ }
2122
+
2123
+ const props = withDefaults(defineProps<Props>(), {
2124
+ msg: 'hello',
2125
+ labels: ():string[] => ['a', 'b'],
2126
+ })
2127
+ ```
2128
+
2129
+ 上面代码会被编译为等价的运行时 props 的 default 选项。此外,`withDefaults` 辅助函数提供了对默认值的类型检查。\
2130
+ 请注意,在使用 `withDefaults` 时,默认值为可变引用类型 (如数组或对象) 应该封装在函数中,以避免意外修改和外部副作用。
2131
+
2132
+ #### withDefaults() 示例 @withdefaults-example
2133
+
2134
+ [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/component-instance/props/props-with-defaults.uvue)
2135
+
2136
+ ::: preview
2137
+ ```vue
2138
+ <template>
2139
+ <view class='mt-10'>
2140
+ <text class="mb-10 bold">withDefaults</text>
2141
+ <view class="mb-10 flex flex-row justify-between">
2142
+ <text>msg</text>
2143
+ <text id="prop-msg">{{ props.msg }}</text>
2144
+ </view>
2145
+ <view class="mb-10 flex flex-row justify-between">
2146
+ <text>labels</text>
2147
+ <text id="prop-labels">{{ JSON.stringify(props.labels) }}</text>
2148
+ </view>
2149
+ </view>
2150
+ </template>
2151
+
2152
+ ```
2153
+
2154
+ ### 与渲染函数一起使用
2155
+
2156
+ 示例 [详情](https://gitcode.com/dcloud/hello-uvue/blob/alpha/pages/render-function/render/render-composition.uvue)
2157
+
2158
+ ::: preview https://hellouvue.dcloud.net.cn/#/pages/render-function/render/render-composition
2159
+ ```vue
2160
+
2161
+ <template><render /></template>
2162
+
2163
+ <style>
2164
+ .btn {
2165
+ color: red;
2166
+ }
2167
+ </style>
2168
+
2169
+ ```