UNNotificationContent:title 属性
title 属性是通知的标题,粗体的一行。这是从请求或通知里读出来的值。
值
字符串。
- 只读。给它赋值抛
TypeError:title is read-only。 - 没有设过时是
''。 - 内容是建请求那一刻的副本,之后不会变,没有变化通知。
示例
js
const content = new UNMutableNotificationContent();
content.title = '订单已发货';
const request = UNNotificationRequest.requestWithIdentifier('order', { content });
console.log(JSON.stringify(request.content.title));结果:输出 "订单已发货"。
对应的 iOS API
UNNotificationContent.title。
参见
UNMutableNotificationContent:写这一项- 这个类属于
@nacrejs/user-notifications包,装法见要先安装