From 3667d0d2d2cd5e9e0d51c5745e33b0a43743043c Mon Sep 17 00:00:00 2001 From: WX997659 <10038940+wx997659@user.noreply.gitee.com> Date: Sun, 24 Apr 2022 08:21:00 +0000 Subject: [PATCH] =?UTF-8?q?update=20Data/JsDistributedData/entry/src/main/?= =?UTF-8?q?js/MainAbility/pages/index/index.js.=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry/src/main/js/MainAbility/pages/index/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Data/JsDistributedData/entry/src/main/js/MainAbility/pages/index/index.js b/Data/JsDistributedData/entry/src/main/js/MainAbility/pages/index/index.js index addaaa3e..511cf45d 100644 --- a/Data/JsDistributedData/entry/src/main/js/MainAbility/pages/index/index.js +++ b/Data/JsDistributedData/entry/src/main/js/MainAbility/pages/index/index.js @@ -28,7 +28,7 @@ export default { }, onInit() { this.title = this.$t('strings.world'); - + this.grantPermission(); // type表示操作0:插入数据、1:修改数据:2:删除数据 this.kvStoreModel.setOnMessageReceivedListener((k, y, type) => { console.info("type=="+type); @@ -46,6 +46,13 @@ export default { } }); }, + grantPermission() { + console.info('Calc[IndexPage] grantPermission') + let context = featureAbility.getContext() + context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) { + console.info(`Calc[IndexPage] grantPermission,requestPermissionsFromUser,result.requestCode=${result.requestCode}`) + }) + }, getIndex(key) { for (let i = 0; i < this.contactList.length; i++) { -- Gitee