diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md index 9108469149f87ad75973ac02caab20f5ce975cee..497724a22e7f94531d890721a8bd3d47f12339d5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md @@ -560,13 +560,13 @@ publish(data: Array<PublishedItem>, bundleName: string, version: number, c ```ts let arrayBuffer = new ArrayBuffer(1); let version = 1; -let data : Array = [{key:"key2", subscriberId:"11", data:arrayBuffer}]; +let dataArray : Array = [{key:"key2", subscriberId:"11", data:arrayBuffer}]; function publishCallback(err, result: Array) { console.info("publishCallback " + JSON.stringify(result)); } try { - console.info("data length is:", data.length); - dataShareHelper.publish(data, "com.acts.ohos.data.datasharetest", version, publishCallback); + console.info("dataArray length is:", dataArray.length); + dataShareHelper.publish(dataArray, "com.acts.ohos.data.datasharetest", version, publishCallback); } catch (e) { console.error("publish error " + JSON.stringify(e)); } @@ -602,11 +602,11 @@ publish(data: Array<PublishedItem>, bundleName: string, callback: AsyncCal function publishCallback(err, result: Array) { console.info("publishCallback " + JSON.stringify(result)); } -let data : Array = [ +let dataArray : Array = [ {key:"city", subscriberId:"11", data:"xian"}, {key:"datashareproxy://com.acts.ohos.data.datasharetest/appInfo", subscriberId:"11", data:"appinfo is just a test app"}, {key:"empty", subscriberId:"11", data:"nobody sub"}]; -dataShareHelper.publish(data, "com.acts.ohos.data.datasharetest", publishCallback); +dataShareHelper.publish(dataArray, "com.acts.ohos.data.datasharetest", publishCallback); ``` ### publish10+ @@ -642,11 +642,11 @@ publish(data: Array<PublishedItem>, bundleName: string, version?: number): **示例:** ```ts -let data : Array = [ +let dataArray : Array = [ {key:"city", subscriberId:"11", data:"xian"}, {key:"datashareproxy://com.acts.ohos.data.datasharetest/appInfo", subscriberId:"11", data:"appinfo is just a test app"}, {key:"empty", subscriberId:"11", data:"nobody sub"}]; -let result: Array = dataShareHelper.publish(data, "com.acts.ohos.data.datasharetest"); +let result: Array = dataShareHelper.publish(dataArray, "com.acts.ohos.data.datasharetest"); ``` ### getPublishedData10+