UNMutableNotificationContent:subtitle 属性
subtitle 属性是通知的副标题,标题下面的一行。
值
字符串。
- 可读,可写。
- 默认值是
''。 - 建请求时内容被复制一份。建好请求之后再改这个属性,已经建好的请求不变。
- 只有 App 自己能改它,没有变化通知。
写错时
- 按字符串转:写数
5得到'5'。 - 写
null或undefined得到空串。 - 不抛异常。
示例
js
const content = new UNMutableNotificationContent();
content.title = '订单已发货';
content.subtitle = '订单号 A1024';
console.log(content.subtitle);结果:输出 订单号 A1024。通知上标题下面多一行「订单号 A1024」(未在模拟器验证)。
对应的 iOS API
UNMutableNotificationContent.subtitle。
参见
UNNotificationContent:读出来的内容上同名的只读属性UNNotificationRequest.requestWithIdentifier():用内容建请求- 这个类属于
@nacrejs/user-notifications包,装法见要先安装