diff --git a/docs/uni-app-x/tutorial/codegap.md b/docs/uni-app-x/tutorial/codegap.md index 0d9b8c60ae7cbab33a52440c12f0474f1dba815b..b1a7c787c5076b63e875765d792c8f75400ee7cb 100644 --- a/docs/uni-app-x/tutorial/codegap.md +++ b/docs/uni-app-x/tutorial/codegap.md @@ -269,6 +269,50 @@ request({url: 'https://www.example.com/request'} as RequestOptions) ![](../static/go-to-definition.png) +## 插件 + +- uni-app x 暂不支持 i18n、Vuex、Pinia 等插件。 + +## 全局变量 + +可通过一个专用模块组织和管理全局变量,例如: + +```ts +// store/index.uts +export type State = { + globalNum: number +} + +export const state = reactive({ globalNum: 0 } as State) + +export const setGlobalNum = (num: number) => { + state.globalNum = num +} +``` + +```ts +// pages/index/index.uvue + + + +``` + ## uts不支持js的一些功能和特性 - 不支持undefined。任何变量被定义后,都需要赋值