Skip to content

Commit 4dd2816

Browse files
author
Zhu Jiefeng
committed
更新文档,规范格式
1 parent b4cc8ad commit 4dd2816

File tree

20 files changed

+84
-178
lines changed

20 files changed

+84
-178
lines changed

docs/API/Lua_Bridge/Data.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Data是OS_Lua系统中的 二进制数据组件。
22

33

4-
4+
## append
55
| api |参数 |返回参数 |平台 |备注|
66
| ------------ | ------------ | ------------ | ------------ | ------------ |
77
| append | v: Data/byte[] | - | - | 新增部分数据 |
@@ -11,6 +11,7 @@ Data是OS_Lua系统中的 二进制数据组件。
1111
Data("a"):append(Data(97, "abc", "def"))
1212
```
1313

14+
## toString
1415
| api |参数 |返回参数 |平台 |备注|
1516
| ------------ | ------------ | ------------ | ------------ |------------ |
1617
| toString | code: String | v: String | - | 转成String(编码格式) |
@@ -20,6 +21,7 @@ Data("a"):append(Data(97, "abc", "def"))
2021
Data('a').toString("latin-1")
2122
```
2223

24+
## toJson
2325
| api |参数 |返回参数 |平台 |备注|
2426
| ------------ | ------------ | ------------ | ------------ |------------ |
2527
| toJson | - | v: String | - | 转成Json String |
@@ -29,6 +31,7 @@ Data('a').toString("latin-1")
2931
Data('{"a":"1"}').toJson()
3032
```
3133

34+
## toTable
3235
| api |参数 |返回参数 |平台 |备注|
3336
| ------------ | ------------ | ------------ | ------------ |------------ |
3437
| toTable | - | v: LuaTable | - | 转成LuaTable |

docs/API/Lua_Bridge/File.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
File是OS_Lua系统中的文件操作组件
22

3-
3+
## save
44
| api |参数 |返回参数 |平台 |备注|
55
| ------------ | ------------ | ------------ | ------------ |------------ |
66
| save | path: String<br>data: Data<br>callback: LuaFunction <br> data: Data <br>path: String<br>callback: LuaFunction | - | - | 保存data内数据到path指定的文件内,文件名支持子目录或者上级目录 |
@@ -15,6 +15,7 @@ File:save("test.html",data, function(status)
1515
end)
1616
```
1717

18+
## read
1819
| api |参数 |返回参数 |平台 |备注|
1920
| ------------ | ------------ | ------------ | ------------ |------------ |
2021
| read | path: String<br>callback: LuaFunction | Data | - | 读取给定path的文件,并返回Data数据,支持异步读取,异步返回数据通过callback返回 |
@@ -27,6 +28,7 @@ File:read("test.html", function(data)
2728
end)
2829
```
2930

31+
## exists
3032
| api |参数 |返回参数 |平台 |备注|
3133
| ------------ | ------------ | ------------ | ------------ |------------ |
3234
| exists | path: String | - | - | 文件是否存在 |
@@ -36,6 +38,7 @@ end)
3638
File.exists("test.html")
3739
```
3840

41+
## path
3942
| api |参数 |返回参数 |平台 |备注|
4043
| ------------ | ------------ | ------------ | ------------ |------------ |
4144
| path | name: filename | path:String | - | 获取给定文件名的绝对存储路径 |

docs/API/Lua_Bridge/Json.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Json是OS_Lua系统中的Json组件
22

3+
## toTable
34
| api |参数 |返回参数 |平台 |备注|
45
| ------------ | ------------ | ------------ | ------------ |------------ |
56
| toTable | v: String/Data/LuaTable | r: LuaTable | - | 给定内容转成LuaTable |
@@ -9,6 +10,7 @@ Json是OS_Lua系统中的Json组件
910
Json():toTable(97, "abc", "def")
1011
```
1112

13+
## isValid
1214
| api |参数 |返回参数 |平台 |备注|
1315
| ------------ | ------------ | ------------ | ------------ |------------ |
1416
| isValid | v: String/Data | r: Boolean | Android | 是否有效JsonString |

docs/API/Lua_Bridge/Native.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ local titleBarHeght = Native:titleBarHeight()
5959
| ------------ | ------------ | ------------ | ------------ |------------ |
6060
| isTitleBarShow | - | Boolean| -| 导航栏是否展示|
6161

62+
例:
6263
```lua
6364
local isTitleBarShow = Native:isTitleBarShow()
6465
```
@@ -68,6 +69,7 @@ local isTitleBarShow = Native:isTitleBarShow()
6869
| ------------ | ------------ | ------------ | ------------ |------------ |
6970
| packageName | - | String| -| 获取应用包名|
7071

72+
例:
7173
```lua
7274
local packageName = Native:packageName()
7375
```
@@ -77,6 +79,7 @@ local packageName = Native:packageName()
7779
| ------------ | ------------ | ------------ | ------------ |------------ |
7880
| getIdentity | - | String| -| 获取设备唯一标志|
7981

82+
例:
8083
```lua
8184
local identity = Native:getIdentity()
8285
```
@@ -86,6 +89,7 @@ local identity = Native:getIdentity()
8689
| ------------ | ------------ | ------------ | ------------ |------------ |
8790
| md5 | String | String| -| 获取字符串的md5值|
8891

92+
例:
8993
```lua
9094
local md5 = Native:md5("os_lua")
9195
```
@@ -95,6 +99,7 @@ local md5 = Native:md5("os_lua")
9599
| ------------ | ------------ | ------------ | ------------ |------------ |
96100
| aesEncrypt | key,iv,content | String| -| aes加密|
97101

102+
例:
98103
```lua
99104
local md5 = Native:aesEncrypt("yourSecretKey","yourIvParameterSpec","os_lua")
100105
```
@@ -104,6 +109,7 @@ local md5 = Native:aesEncrypt("yourSecretKey","yourIvParameterSpec","os_lua")
104109
| ------------ | ------------ | ------------ | ------------ |------------ |
105110
| aesDecrypt | key,iv,content | String| -| aes解密|
106111

112+
例:
107113
```lua
108114
local md5 = Native:aesDecrypt("yourSecretKey","yourIvParameterSpec","os_lua")
109115
```
@@ -113,6 +119,7 @@ local md5 = Native:aesDecrypt("yourSecretKey","yourIvParameterSpec","os_lua")
113119
| ------------ | ------------ | ------------ | ------------ |------------ |
114120
| zipString | String | String| -| 字符串压缩|
115121

122+
例:
116123
```lua
117124
local zipString = Native:zipString("os_lua")
118125
```
@@ -122,6 +129,7 @@ local zipString = Native:zipString("os_lua")
122129
| ------------ | ------------ | ------------ | ------------ |------------ |
123130
| unZipString | String | String| -| 字符串解压缩|
124131

132+
例:
125133
```lua
126134
local unZipString = Native:unZipString("os_lua")
127135
```
@@ -132,6 +140,7 @@ local unZipString = Native:unZipString("os_lua")
132140
| ------------ | ------------ | ------------ | ------------ |------------ |
133141
| unZipFile | filePath:待解压的文件路径,targetPath:解压后的文件路径 | Number| -| 文件解压缩|
134142

143+
例:
135144
```lua
136145
local unZipFile = Native:unZipFile("sourceFile","yourTargetPath")
137146
```
@@ -142,6 +151,7 @@ local unZipFile = Native:unZipFile("sourceFile","yourTargetPath")
142151
| ------------ | ------------ | ------------ | ------------ |------------ |
143152
| encode | String | String| -| url encode|
144153

154+
例:
145155
```lua
146156
local encode = Native:encode("http://....")
147157
```
@@ -152,6 +162,7 @@ local encode = Native:encode("http://....")
152162
| ------------ | ------------ | ------------ | ------------ |------------ |
153163
| decode | String | String| -| url decode|
154164

165+
例:
155166
```lua
156167
local encode = Native:decode("http://....")
157168
```
@@ -161,6 +172,7 @@ local encode = Native:decode("http://....")
161172
| ------------ | ------------ | ------------ | ------------ |------------ |
162173
| base64Encode | String | String| -| 字符串进行 base64Encode|
163174

175+
例:
164176
```lua
165177
local result = Native:base64Encode("os_lua")
166178
```
@@ -170,6 +182,7 @@ local result = Native:base64Encode("os_lua")
170182
| ------------ | ------------ | ------------ | ------------ |------------ |
171183
| base64Decode | String | String| -| 字符串进行 base64Decode|
172184

185+
例:
173186
```lua
174187
local result = Native:base64Decode("os_lua")
175188
```
@@ -180,6 +193,7 @@ local result = Native:base64Decode("os_lua")
180193
| ------------ | ------------ | ------------ | ------------ |------------ |
181194
| destroyView | - | -| -| 销毁当前LuaView对象|
182195

196+
例:
183197
```lua
184198
Native:destroyView()
185199
```
@@ -189,6 +203,7 @@ local result = Native:base64Decode("os_lua")
189203
| ------------ | ------------ | ------------ | ------------ |------------ |
190204
| stringDrawLength | text:String,testSize:Float | Float | -| 获取字符串显示的宽度值 |
191205

206+
例:
192207
```lua
193208
local textWidth = Native:stringDrawLength("os_lua",12.1)
194209
```
@@ -198,6 +213,7 @@ local textWidth = Native:stringDrawLength("os_lua",12.1)
198213
| ------------ | ------------ | ------------ | ------------ |------------ |
199214
| sendAction | uri:String,data:LuaTable | - | -| 路由跳转功能 |
200215

216+
例:
201217
```lua
202218
local base64LuaName = Native:base64Encode("test.lua")
203219
--关闭前一个testFile形成的LuaView

docs/API/Lua_Bridge/Page.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
| ------------ | ------------ | ------------ | ------------ |------------ |
1717
| onPageWillAppear | LuaFunction| -|-| 页面刚开始创建时调用|
1818

19-
```
2019
例:
20+
```lua
2121
local page = Page()
2222
media:onPageWillAppear(function()
2323

@@ -29,8 +29,8 @@ end)
2929
| ------------ | ------------ | ------------ | ------------ |------------ |
3030
| onPageDidAppear | LuaFunction| -|-| 页面已经可见时调用|
3131

32-
```
3332
例:
33+
```lua
3434
local page = Page()
3535
media:onPageDidAppear(function()
3636

@@ -42,8 +42,8 @@ end)
4242
| ------------ | ------------ | ------------ | ------------ |------------ |
4343
| onPagePause | LuaFunction| -|-| 页面暂停时调用|
4444

45-
```
4645
例:
46+
```lua
4747
local page = Page()
4848
media:onPagePause(function()
4949

@@ -55,8 +55,8 @@ end)
5555
| ------------ | ------------ | ------------ | ------------ |------------ |
5656
| onPageWillDisappear | LuaFunction| -|iOS| 页面即将不可见时调用|
5757

58-
```
5958
例:
59+
```lua
6060
local page = Page()
6161
media:onPageWillDisappear(function()
6262

@@ -68,8 +68,8 @@ end)
6868
| ------------ | ------------ | ------------ | ------------ |------------ |
6969
| onPageDidDisappear | LuaFunction| -|iOS| 页面不可见时调用|
7070

71-
```
7271
例:
72+
```lua
7373
local page = Page()
7474
media:onPageDidDisappear(function()
7575

@@ -82,8 +82,8 @@ end)
8282
| ------------ | ------------ | ------------ | ------------ |------------ |
8383
| onPageDestroy | LuaFunction| -|iOS| 页面销毁时调用|
8484

85-
```
8685
例:
86+
```lua
8787
local page = Page()
8888
media:onPageDestroy(function()
8989

docs/API/Lua_Bridge/System.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
| ------------ | ------------ | ------------ | ------------ |------------ |
2121
| ios | - | Boolean| -| 是否是iOS平台|
2222

23-
```
2423
例:
24+
```lua
2525
local isIOS = System:ios()
2626
```
2727

@@ -30,8 +30,8 @@ local isIOS = System:ios()
3030
| ------------ | ------------ | ------------ | ------------ |------------ |
3131
| android | - | Boolean| -| 是否是Android平台|
3232

33-
```
3433
例:
34+
```lua
3535
local isAndoroid = System:android()
3636
```
3737

@@ -40,8 +40,8 @@ local isAndoroid = System:android()
4040
| ------------ | ------------ | ------------ | ------------ |------------ |
4141
| sdkVersion | - | String| -| LuaView版本|
4242

43-
```
4443
例:
44+
```lua
4545
local sdkVersion = System:sdkVersion()
4646
```
4747

@@ -50,8 +50,8 @@ local sdkVersion = System:sdkVersion()
5050
| ------------ | ------------ | ------------ | ------------ |------------ |
5151
| osVersion | - | String| -| 操作系统版本|
5252

53-
```
5453
例:
54+
```lua
5555
local osVersion = System:osVersion()
5656
```
5757

@@ -60,8 +60,8 @@ local osVersion = System:osVersion()
6060
| ------------ | ------------ | ------------ | ------------ |------------ |
6161
| platform | - | String| -| 平台系统型号|
6262

63-
```
6463
例:
64+
```lua
6565
local platform = System:platform()
6666
```
6767

@@ -70,8 +70,8 @@ local platform = System:platform()
7070
| ------------ | ------------ | ------------ | ------------ |------------ |
7171
| scale | - | Number| -| 屏幕缩放比|
7272

73-
```
7473
例:
74+
```lua
7575
local scale = System:scale()
7676
```
7777

@@ -80,8 +80,8 @@ local scale = System:scale()
8080
| ------------ | ------------ | ------------ | ------------ |------------ |
8181
| device | - | LuaTable| -| 设备信息|
8282

83-
```
8483
例:
84+
```lua
8585
local deviceTable = System:device()
8686
local device = deviceTable.device
8787
local brand = deviceTable.brand
@@ -92,17 +92,15 @@ local windowHeight = deviceTable.window_height
9292
lcoal navHeight = deviceTable.nav_height
9393
local bottomNavHeight=deviceTable.bottom_nav_height
9494
local statusBarHeight = deviceTable.status_bar_height
95-
96-
9795
```
9896

9997
## screenSize
10098
| api |参数 |返回参数 |平台 |备注|
10199
| ------------ | ------------ | ------------ | ------------ |------------ |
102100
| screenSize | - | width:Number,height:Number| -| 屏幕尺寸|
103101

104-
```
105102
例:
103+
```lua
106104
local width,height = System:screenSize()
107105
```
108106

@@ -111,8 +109,8 @@ local width,height = System:screenSize()
111109
| ------------ | ------------ | ------------ | ------------ |------------ |
112110
| gc | - | -| -| 执行内存回收|
113111

114-
```
115112
例:
113+
```lua
116114
System:gc()
117115
```
118116

@@ -121,7 +119,7 @@ System:gc()
121119
| ------------ | ------------ | ------------ | ------------ |------------ |
122120
| keepScreenOn | - | Boolean| -| 是否保持屏幕常亮|
123121

124-
```
125122
例:
123+
```lua
126124
local keepScreenOn = System:keepScreenOn()
127125
```

0 commit comments

Comments
 (0)