未验证 提交 b3ca8ada 编写于 作者: O openharmony_ci 提交者: Gitee

!22374 【轻量级PR】将所有本地开发的库名@ohos/library改为library,并修正两个大括号不匹配错误(中英文同步修改)

Merge pull request !22374 from Haoming Luo/lhm8
......@@ -98,7 +98,7 @@ To start with, [configure dependency](https://developer.harmonyos.com/cn/docs/do
After configuring the dependency on the HAR, you can reference ArkUI components exported from the HAR by using **import**. The sample code is as follows:
```js
// entry/src/main/ets/pages/index.ets
import { MainPage } from "@ohos/library"
import { MainPage } from "library"
@Entry
@Component
......@@ -123,8 +123,8 @@ struct Index {
To reference the TS classes and methods exported from the HAR, use **import** as follows:
```js
// entry/src/main/ets/pages/index.ets
import { Log } from "@ohos/library"
import { func } from "@ohos/library"
import { Log } from "library"
import { func } from "library"
@Entry
@Component
......
......@@ -183,6 +183,7 @@ The AI subsystem is the part of OpenHarmony that provides native distributed AI
* returns a non-zero value otherwise.
*/
int32_t Destroy();
}
```
>**Note**: The sequence for the SDK to call client APIs of the AI engine is as follows: AieClientInit -\> AieClientPrepare -\> AieClientSyncProcess/AieClientAsyncProcess -\> AieClientRelease -\> AieClientDestroy. An exception will be thrown if the call sequence is violated. In addition, all these APIs must be called. Otherwise, a memory leakage may occur.
......
......@@ -51,7 +51,7 @@ ohpm install
```
"dependencies": {
"@ohos/library": "file:../library"
"library": "file:../library"
}
```
......@@ -69,12 +69,12 @@ ohpm install
### Referencing an HAR HML Page
In a JavaScript project paradigm, component functions are configured in HML files. To reference an HML page in an HAR, first import the page through the **<element>** tag in the HML file of the project. The sample code is as follows:
```
<element name="comp" src="@ohos/library/src/main/js/components/index/index.hml"></element>
<element name="comp" src="library/src/main/js/components/index/index.hml"></element>
```
In the preceding example, **@ohos/library** indicates the name of the HAR, and the path of the HML page is the relative path in the HAR.
In the preceding example, **library** indicates the name of the HAR, and the path of the HML page is the relative path in the HAR.
You can then reference the HML page based on the set element name. The sample code is as follows:
```typescript
<element name="comp" src="@ohos/library/src/main/js/components/index/index.hml"></element>
<element name="comp" src="library/src/main/js/components/index/index.hml"></element>
<div class="container">
<comp></comp>
......@@ -107,7 +107,7 @@ Import the exported ArkTS page in other modules. The following is an example:
```typescript
// entry/MainAbility/pages/index.ets
import { MainPage } from "@ohos/library"
import { MainPage } from "library"
@Entry
@Component
struct Index {
......@@ -136,7 +136,7 @@ export function func() {
On other JavaScript/TypeScript pages, use **import** to import the exported methods. The sample code is as follows:
```typescript
// entry/src/main/js/MainAbility/pages/index/index.js
import {func} from "@ohos/library"
import {func} from "library"
export default {
data: {
title: ""
......
......@@ -135,7 +135,7 @@ HAR模块编译打包时会把资源打包到HAR中。在编译构建HAP时,De
HAR的依赖配置成功后,可以引用HAR的ArkUI组件。ArkUI组件的导入方式与ts的导入方式一致,通过`import`引入HAR导出的ArkUI组件,示例如下所示:
```js
// entry/src/main/ets/pages/index.ets
import { MainPage } from "@ohos/library"
import { MainPage } from "library"
@Entry
@Component
......@@ -160,8 +160,8 @@ struct Index {
通过`import`引用HAR导出的ts类和方法,示例如下所示:
```js
// entry/src/main/ets/pages/index.ets
import { Log } from "@ohos/library"
import { func } from "@ohos/library"
import { Log } from "library"
import { func } from "library"
@Entry
@Component
......
......@@ -353,7 +353,7 @@ struct MyComponent {
```ts
// entry/src/main/ets/pages/Index.ets
import router from '@ohos.router';
import '@ohos/library/src/main/ets/Index.ets' // 引入共享包library中的命名路由页面
import 'library/src/main/ets/Index.ets' // 引入共享包library中的命名路由页面
@Entry
@Component
......
......@@ -190,6 +190,7 @@ AI业务子系统是OpenHarmony提供原生的分布式AI能力的子系统。
* returns a non-zero value otherwise.
*/
int32_t Destroy();
}
```
>**注意**:SDK调用AI引擎客户端接口顺序应遵循AieClientInit-\>AieClientPrepare-\>AieClientSyncProcess/AieClientAsyncProcess-\>AieClientRelease-\>AieClientDestroy,否则调用接口会返回错误码;同时应保证各个接口都有调用到,要不然会引起内存泄漏。
......
......@@ -50,7 +50,7 @@ ohpm install ../library
- 方式二:在工程的oh-package.json5中设置三方包依赖,配置示例如下:
```
"dependencies": {
"@ohos/library": "file:../library"
"library": "file:../library"
}
```
依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。
......@@ -69,12 +69,12 @@ ohpm install
### 引用OpenHarmony HAR hml页面
在JS工程范式中,组件功能由hml承载,开发者可以在JS工程的hml页面通过<element>标签来引入OpenHarmony HAR中的共享hml页面,示例如下:
```
<element name="comp" src="@ohos/library/src/main/js/components/index/index.hml"></element>
<element name="comp" src="library/src/main/js/components/index/index.hml"></element>
```
其中,@ohos/library为OpenHarmony HAR的包名,hml页面的路径为OpenHarmony HAR中的相对路径。
其中,library为OpenHarmony HAR的包名,hml页面的路径为OpenHarmony HAR中的相对路径。
随后便可以通过设置的name来使用该element元素,以引用OpenHarmony HAR中的hml页面,示例如下:
```typescript
<element name="comp" src="@ohos/library/src/main/js/components/index/index.hml"></element>
<element name="comp" src="library/src/main/js/components/index/index.hml"></element>
<div class="container">
<comp></comp>
......@@ -107,7 +107,7 @@ export struct MainPage {
```typescript
// entry/MainAbility/pages/index.ets
import { MainPage } from "@ohos/library"
import { MainPage } from "library"
@Entry
@Component
struct Index {
......@@ -136,7 +136,7 @@ export function func() {
然后在其它的ts/js页面中,通过import引入导出的ts/js方法,示例如下所示:
```typescript
// entry/src/main/js/MainAbility/pages/index/index.js
import {func} from "@ohos/library"
import {func} from "library"
export default {
data: {
title: ""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册