Skip to content

API 概览

HarmonyOS 提供了丰富的 API,涵盖 UI、网络、存储、设备等各个方面。

API 分类

基础 UI

  • 组件装饰器:@Component、@Entry、@Preview
  • 状态管理:@State、@Prop、@Link
  • 样式装饰器:@Styles、@Extend

网络通信

  • HTTP 请求:@ohos.net.http
  • WebSocket:@ohos.net.webSocket

数据存储

  • 首选项:@ohos.data.preferences
  • 关系型数据库:@ohos.data.relationalStore

设备功能

  • 相机:@ohos.multimedia.camera
  • 位置:@ohos.geoLocationManager
  • 传感器:@ohos.sensor

常用模块

typescript
// 路由导航
import router from '@ohos.router'

// HTTP 请求
import http from '@ohos.net.http'

// 数据存储
import preferences from '@ohos.data.preferences'

// 日志
import hilog from '@ohos.hilog'

下一步

最后更新于:

全栈若城