// #ifdef APP-PLUS
let timer
// 监听点击消息事件
plus.push.addEventListener('click',function(msg){
clearTimeout(timer)
let payload = msg.payload
console.log(msg)
timer = setTimeout(function(){
if(payload){
uni.navigateTo({
url: '/pages/news/news?payload=' + JSON.stringify(payload)
})
}
},1500)
})
// 监听在线消息事件
plus.push.addEventListener('receive',function(msg){
console.log(msg)
if('LocalMSG' == msg.payload){}else{
if(msg.type == 'receive'){
var options = {cover:false,title:msg.title}
plus.push.createMessage(msg.content,msg.payload,options)
}
}
})
// #endif
代码如上,消息厂商离线推送,点击消息栏目无法唤醒APP
1 个回复
DCloud_uniCloud_JSON
请参考插件 https://ext.dcloud.net.cn/plugin?id=1680