当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
1.4K Star 7.4K Fork 8.2K

OpenHarmony/docs
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
js-apis-system-notification.md 2.70 KB
一键复制 编辑 原始数据 按行查看 历史
zengyawen 提交于 3年前 . update docs

通知消息

icon-note.gif 说明:

  • 从API Version 7 开始,该接口不再维护,推荐使用新接口@ohos.notification

  • 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

导入模块

import notification from '@system.notification';

ActionResult

系统能力:以下各项对应的系统能力均为SystemCapability.Notification.Notification

名称 可读 可写 类型 必填 描述
bundleName string 单击通知后要重定向到的应用程序的Bundle名。
abilityName string 单击通知后要重定向到的应用程序的Ability名称。
uri string 要重定向到的页面的uri。

ShowNotificationOptions

系统能力:以下各项对应的系统能力均为SystemCapability.Notification.Notification

名称 可读 可写 类型 必填 描述
contentTitle string 通知标题。
contentText string 通知内容。
clickAction ActionResult 通知被点击后触发的行为。

notification.show

show(options?: ShowNotificationOptions): void

显示通知。

系统能力: SystemCapability.Notification.Notification

参数:

参数名 类型 必填 说明
options ShowNotificationOptions 通知标题。

示例:

export default {    
  show() {        
    notification.show({            
      contentTitle: 'title info',            
        contentText: 'text',            
        clickAction: {                
          bundleName: 'com.example.testapp',                
          abilityName: 'notificationDemo',                
          uri: '/path/to/notification',            
         },
     });    
  },
}
;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
其他
1
https://gitee.com/openharmony/docs.git
git@gitee.com:openharmony/docs.git
openharmony
docs
docs
OpenHarmony-3.2-Beta1

搜索帮助