Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
c138e09b
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c138e09b
编写于
6月 12, 2023
作者:
Y
yuyaozhi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix vod error
Signed-off-by:
N
yuyaozhi
<
yuyaozhi@huawei.com
>
上级
5a4ce19a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
9 deletion
+9
-9
zh-cn/application-dev/application-models/create-dataability.md
.../application-dev/application-models/create-dataability.md
+3
-3
zh-cn/application-dev/application-models/js-ui-widget-development.md
...cation-dev/application-models/js-ui-widget-development.md
+3
-3
zh-cn/application-dev/application-models/widget-development-fa.md
...plication-dev/application-models/widget-development-fa.md
+3
-3
未找到文件。
zh-cn/application-dev/application-models/create-dataability.md
浏览文件 @
c138e09b
...
...
@@ -9,18 +9,18 @@
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
dataAbility
from
'
@ohos.data.dataAbility
'
import
dataRdb
from
'
@ohos.data.rdb
'
import
relationalStore
from
'
@ohos.data.relationalStore
'
const
TABLE_NAME
=
'
book
'
const
STORE_CONFIG
=
{
name
:
'
book.db
'
}
const
SQL_CREATE_TABLE
=
'
CREATE TABLE IF NOT EXISTS book(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, introduction TEXT NOT NULL)
'
let
rdbStore
:
dataRdb
.
RdbStore
=
undefined
let
rdbStore
:
relationalStore
.
RdbStore
=
undefined
export
default
{
onInitialized
(
abilityInfo
)
{
console
.
info
(
'
DataAbility onInitialized, abilityInfo:
'
+
abilityInfo
.
bundleName
)
let
context
=
featureAbility
.
getContext
()
dataRdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
,
(
err
,
store
)
=>
{
relationalStore
.
getRdbStore
(
context
,
STORE_CONFIG
,
(
err
,
store
)
=>
{
console
.
info
(
'
DataAbility getRdbStore callback
'
)
store
.
executeSql
(
SQL_CREATE_TABLE
,
[])
rdbStore
=
store
...
...
zh-cn/application-dev/application-models/js-ui-widget-development.md
浏览文件 @
c138e09b
...
...
@@ -102,7 +102,7 @@ Stage卡片开发,即基于[Stage模型](stage-model-development-overview.md)
import
formBindingData
from
'
@ohos.app.form.formBindingData
'
;
import
formInfo
from
'
@ohos.app.form.formInfo
'
;
import
formProvider
from
'
@ohos.app.form.formProvider
'
;
import
data
Storage
from
'
@ohos.data.storage
'
;
import
data
Preferences
from
'
@ohos.data.preferences
'
;
```
2.
在EntryFormAbility.ts中,实现FormExtension生命周期接口。
...
...
@@ -255,7 +255,7 @@ async function storeFormInfo(formId: string, formName: string, tempFlag: boolean
"
updateCount
"
:
0
};
try
{
const
storage
=
await
data
Storage
.
getStorage
(
DATA_STORAGE_PATH
);
const
storage
=
await
data
Preferences
.
getPreferences
(
this
.
context
,
DATA_STORAGE_PATH
);
// put form info
await
storage
.
put
(
formId
,
JSON
.
stringify
(
formInfo
));
console
.
info
(
`[EntryFormAbility] storeFormInfo, put form info successfully, formId:
${
formId
}
`
);
...
...
@@ -294,7 +294,7 @@ export default class EntryFormAbility extends FormExtension {
const
DATA_STORAGE_PATH
=
"
/data/storage/el2/base/haps/form_store
"
;
async
function
deleteFormInfo
(
formId
:
string
)
{
try
{
const
storage
=
await
data
Storage
.
getStorage
(
DATA_STORAGE_PATH
);
const
storage
=
await
data
Preferences
.
getPreferences
(
this
.
context
,
DATA_STORAGE_PATH
);
// del form info
await
storage
.
delete
(
formId
);
console
.
info
(
`[EntryFormAbility] deleteFormInfo, del form info successfully, formId:
${
formId
}
`
);
...
...
zh-cn/application-dev/application-models/widget-development-fa.md
浏览文件 @
c138e09b
...
...
@@ -114,7 +114,7 @@ FA卡片开发,即基于[FA模型](fa-model-development-overview.md)的卡片
import
formBindingData
from
'
@ohos.app.form.formBindingData
'
;
import
formInfo
from
'
@ohos.app.form.formInfo
'
;
import
formProvider
from
'
@ohos.app.form.formProvider
'
;
import
data
Storage
from
'
@ohos.data.storage
'
;
import
data
Preferences
from
'
@ohos.data.preferences
'
;
```
2.
在form.ts中,实现卡片生命周期接口
...
...
@@ -263,7 +263,7 @@ async function storeFormInfo(formId: string, formName: string, tempFlag: boolean
"
updateCount
"
:
0
};
try
{
const
storage
=
await
data
Storage
.
getStorage
(
DATA_STORAGE_PATH
);
const
storage
=
await
data
Preferences
.
getPreferences
(
this
.
context
,
DATA_STORAGE_PATH
);
// put form info
await
storage
.
put
(
formId
,
JSON
.
stringify
(
formInfo
));
console
.
info
(
`storeFormInfo, put form info successfully, formId:
${
formId
}
`
);
...
...
@@ -301,7 +301,7 @@ async function storeFormInfo(formId: string, formName: string, tempFlag: boolean
const
DATA_STORAGE_PATH
=
"
/data/storage/el2/base/haps/form_store
"
;
async
function
deleteFormInfo
(
formId
:
string
)
{
try
{
const
storage
=
await
data
Storage
.
getStorage
(
DATA_STORAGE_PATH
);
const
storage
=
await
data
Preferences
.
getPreferences
(
this
.
context
,
DATA_STORAGE_PATH
);
// del form info
await
storage
.
delete
(
formId
);
console
.
info
(
`deleteFormInfo, del form info successfully, formId:
${
formId
}
`
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录