|
@@ -4,6 +4,28 @@
|
|
ohpm install @szyx/sdk_base
|
|
ohpm install @szyx/sdk_base
|
|
```
|
|
```
|
|
|
|
|
|
|
|
+## 0.初始化
|
|
|
|
+> 在UIAbility的onWindowStageCreate方法中初始化该方法
|
|
|
|
+
|
|
|
|
+```tsx
|
|
|
|
+// 初始化
|
|
|
|
+import { WindowHelper } from '@szyx/sdk_base';
|
|
|
|
+export default class AppAbility extends UIAbility {
|
|
|
|
+ onWindowStageCreate(windowStage: window.WindowStage): void {
|
|
|
|
+
|
|
|
|
+ windowStage.loadContent('pages/Index', (err) => {
|
|
|
|
+ if (err.code) {
|
|
|
|
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ WindowHelper.windowClass = windowStage.getMainWindowSync()
|
|
|
|
+ });
|
|
|
|
+ // 这行代码
|
|
|
|
+ GlobalContext.setContext(this.context)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+```
|
|
|
|
+
|
|
## 1.[utils](./src/main/ets/utils)
|
|
## 1.[utils](./src/main/ets/utils)
|
|
|
|
|
|
### 1.1.[AppStorageHelper](./src/main/ets/utils/AppStorageHelper.ets)
|
|
### 1.1.[AppStorageHelper](./src/main/ets/utils/AppStorageHelper.ets)
|
|
@@ -330,24 +352,6 @@ WindowHelper.close()
|
|
|
|
|
|
### 5.2.设置沉浸式相关
|
|
### 5.2.设置沉浸式相关
|
|
|
|
|
|
-```tsx
|
|
|
|
-// 初始化
|
|
|
|
-import { WindowHelper } from '@szyx/sdk_base';
|
|
|
|
-export default class AppAbility extends UIAbility {
|
|
|
|
- onWindowStageCreate(windowStage: window.WindowStage): void {
|
|
|
|
-
|
|
|
|
- windowStage.loadContent('pages/Index', (err) => {
|
|
|
|
- if (err.code) {
|
|
|
|
- hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- WindowHelper.windowClass = windowStage.getMainWindowSync()
|
|
|
|
- });
|
|
|
|
- GlobalContext.setContext(this.context)
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-```
|
|
|
|
-
|
|
|
|
```tsx
|
|
```tsx
|
|
// 需要的界面
|
|
// 需要的界面
|
|
// 设置是否全屏
|
|
// 设置是否全屏
|