为帮助用户更好更快的使用插件,论坛维护了一个示例,示例中包含示例代码、知识点讲解、注意事项等,供您参考。
通知
发送一条通知
sendNotification({params})
```js { channelId:'chat', channelName:'消息通知', smallIcon:'widget://icon/qianniu.png', bigIcon:'widget://icon/qianniu.png', title:'消息通知111', msgOne:{text:'处罚及预警',num:10}, msgTwo:{text:'售后服务',num:5}, msgThree:{text:'货源消息',num:4}, msgFour:{text:'其他消息',num:1}
},function(ret) {
if (ret.code==0) {
alert(ret.msg);
}
}```
```js var notification = api.require('customNotification'); notification.sendNotification({ channelId:'chat', channelName:'消息通知', smallIcon:'widget://icon/qianniu.png', bigIcon:'widget://icon/qianniu.png', title:'消息通知111', msgOne:{text:'处罚及预警',num:10}, msgTwo:{text:'售后服务',num:5}, msgThree:{text:'货源消息',num:4}, msgFour:{text:'其他消息',num:1}
},function(ret) {
if (ret.code==0) {
alert(ret.msg);
}
});```
Android,ios系统
可提供的1.0.0
更新通知
updateNotification({params})
js { smallIcon:'widget://icon/qianniu.png', bigIcon:'widget://icon/qianniu.png', title:'消息通知11122222222', msgOne:{text:'处罚及预警',num:60}, msgTwo:{text:'售后服务',num:5}, msgThree:{text:'货源消息',num:4}, msgFour:{text:'其他消息',num:1} },function(ret) { if (ret.code==0) { alert(ret.msg); } }
js var notification = api.require('customNotification'); notification.updateNotification({ smallIcon:'widget://icon/qianniu.png', bigIcon:'widget://icon/qianniu.png', title:'消息通知11122222222', msgOne:{text:'处罚及预警',num:60}, msgTwo:{text:'售后服务',num:5}, msgThree:{text:'货源消息',num:4}, msgFour:{text:'其他消息',num:1} },function(ret) { if (ret.code==0) { alert(ret.msg); } });
Android,ios系统
可提供的1.0.0
js var office = api.require('officePreview'); office.show();
Android,ios系统
可提供的1.0.6