|
@@ -31,7 +31,7 @@ export default class AppAbility extends UIAbility {
|
|
|
|
|
|
> 缓存工具类,运行时存储,应用停止运行后清空
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { AppStorageHelper } from '@szyx/sdk_base/Index'
|
|
|
|
|
|
// 存储string数据
|
|
@@ -49,7 +49,7 @@ AppStorageHelper.delete(StorageKeys.CLIENT_ID)
|
|
|
> 需要验证,更新应用会不会被清理
|
|
|
> 可存储类型 `number | string | boolean | Array<number> | Array<string> | Array<boolean> | Uint8Array`
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { PreferencesHelper } from '@szyx/sdk_base/Index'
|
|
|
|
|
|
// 存储数据
|
|
@@ -72,7 +72,7 @@ PreferencesHelper.delete(StorageKeys.CLIENT_ID).then(() => {
|
|
|
|
|
|
#### 1.3.1.弹出Toast提示
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { ToolsHelper } from '@szyx/sdk_base';
|
|
|
|
|
|
ToolsHelper.showMessage('Hello Word!')
|
|
@@ -82,7 +82,7 @@ ToolsHelper.showMessage('Hello Word!')
|
|
|
|
|
|
> 打印格式:`========>${顶层调用栈}::`
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { ToolsHelper } from '@szyx/sdk_base';
|
|
|
|
|
|
ToolsHelper.log('Hello Word!')
|
|
@@ -90,7 +90,7 @@ ToolsHelper.log('Hello Word!')
|
|
|
|
|
|
#### 1.3.3.获取调用栈第一个
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { ToolsHelper } from '@szyx/sdk_base';
|
|
|
|
|
|
ToolsHelper.getStackKey()
|
|
@@ -98,7 +98,7 @@ ToolsHelper.getStackKey()
|
|
|
|
|
|
#### 1.3.4.获取设备信息
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { ToolsHelper } from '@szyx/sdk_base';
|
|
|
|
|
|
ToolsHelper.getDeviceInfo()
|
|
@@ -110,7 +110,7 @@ ToolsHelper.getDeviceInfo()
|
|
|
|
|
|
#### 1.4.1.验证手机号
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { ValidatorHelper } from '@szyx/sdk_base';
|
|
|
|
|
|
ValidatorHelper.isPhone('13800000000')
|
|
@@ -118,7 +118,7 @@ ValidatorHelper.isPhone('13800000000')
|
|
|
|
|
|
#### 1.4.2.是否为身份证号
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { ValidatorHelper } from '@szyx/sdk_base';
|
|
|
|
|
|
ValidatorHelper.isIdcardNum()
|
|
@@ -131,7 +131,7 @@ ValidatorHelper.isIdcardNum()
|
|
|
|
|
|
#### 1.5.1.计算两点间距离
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { AlgorithmHelper } from '@szyx/sdk_base';
|
|
|
|
|
|
AlgorithmHelper.calculateDistance(x1, y1, x2, y2)
|
|
@@ -141,7 +141,7 @@ AlgorithmHelper.calculateDistance(x1, y1, x2, y2)
|
|
|
|
|
|
> 打开webview页面
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { XWebHelper } from '@szyx/sdk_base';
|
|
|
|
|
|
// 必须先引入,否则无法跳转
|
|
@@ -160,7 +160,7 @@ XWebHelper.openWeb({
|
|
|
|
|
|
#### 1.7.1 选择日期
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
import { PickerDateTimeHelper } from '@szyx/sdk_base'
|
|
|
|
|
|
PickerDateTimeHelper.showDateDialog({
|
|
@@ -174,7 +174,7 @@ PickerDateTimeHelper.showDateDialog({
|
|
|
|
|
|
### 2.1.弹出list选中弹窗
|
|
|
|
|
|
-```
|
|
|
+```tsx
|
|
|
import { XDialogController } from '../dialog/XDialogController';
|
|
|
import { XDialogList } from '../dialog/XDialogList';
|
|
|
|
|
@@ -233,7 +233,7 @@ struct MyView{
|
|
|
> 使用时建议二次封装
|
|
|
>
|
|
|
> 参数定义
|
|
|
-> ```typescript
|
|
|
+> ```tsx
|
|
|
> /**
|
|
|
> *
|
|
|
> * @param url url地址
|
|
@@ -246,7 +246,7 @@ struct MyView{
|
|
|
|
|
|
### 3.1.get请求
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
|
|
|
HttpHelper.get()
|
|
|
.get<HttpResult<T>>(url.url.startsWith('http') ? url.url : GlobalValue.getInstance().envUrl + url.url,
|
|
@@ -276,7 +276,7 @@ HttpHelper.get()
|
|
|
|
|
|
### 3.2.postJson
|
|
|
|
|
|
-```typescript
|
|
|
+```tsx
|
|
|
|
|
|
HttpHelper.get()
|
|
|
.post<HttpResult<T>>(url.url.startsWith('http') ? url.url : GlobalValue.getInstance().envUrl + url.url,
|