ionic-framework - 离子中的本地通知
问题描述
这是我的代码
this.platform.ready().then(() => {
this.localNotifications.schedule({ // ionic local notification native plugin.
title: 'Welcome',
text: 'xxxxxxxxxx',
at: new Date(new Date().getTime() + 1000)
})
})
使用at:
变量时,我得到的错误是
'{ title: any; 类型的参数 文本:字符串;在:日期;}' 不可分配给“ILocalNotification |”类型的参数 本地通知”。对象字面量只能指定已知属性,而 'at' 不存在于类型 'ILocalNotification | 本地通知”。
我想在 1 秒后提示通知。我该怎么做 ?
解决方案
您的选项对象与本地通知选项不匹配,请查看此链接https://ionicframework.com/docs/native/local-notifications/。在这里您可以找到所有选项。对于计划 1 秒延迟本地通知,您可以像这样修改代码。
this.localNotifications.schedule({
title: 'Welcome',
text: 'xxxxxxxxxx',
trigger: {at: new Date(new Date().getTime() + 1000)},
});
希望你能找到你的解决方案。
推荐阅读
- java - why JVM Current old generation capacity + new generation capacity+Metaspace capacity not equals physical memory
- angular - 未捕获(承诺):错误:模板解析错误:无法绑定到“上传器”,因为它不是“输入”的已知属性
- r - 闪亮的应用地图未正确连接到单选按钮
- neo4j - 将一个标签的“属性键”合并到另一个标签中
- jpa - 集成 Java EE 7、Spring Security 和 EclipseLink 的问题
- amazon-web-services - 在 AWS RHEL 7.6 实例上安装 SCL
- c++ - 多线程 Monte Carlo pi 计算会因更多线程而失去精度?
- odoo - Odoo 11 工人
- python - 如何将列表的元素作为 np.where() 中的条件?
- java - 在 Spring Boot jar 中解压球衣库