Javascript 如何在React中的Firebase推送通知中添加自定义按钮?
我正在使用firebase通知,并添加自定义按钮。但是推送通知只显示文本,而不显示操作按钮。。。大概是这样的: 以下是代码片段:Javascript 如何在React中的Firebase推送通知中添加自定义按钮?,javascript,reactjs,firebase,react-redux,firebase-cloud-messaging,Javascript,Reactjs,Firebase,React Redux,Firebase Cloud Messaging,我正在使用firebase通知,并添加自定义按钮。但是推送通知只显示文本,而不显示操作按钮。。。大概是这样的: 以下是代码片段: self.addEventListener('push', function (event) { console.log('Push Notification Received.'); var eventData = event.data.text(); obj = JSON.parse(eventData); //Parse the rec
self.addEventListener('push', function (event) {
console.log('Push Notification Received.');
var eventData = event.data.text();
obj = JSON.parse(eventData); //Parse the received JSON object.
notifyPayload = obj;
var options = {
body: obj.data.body,
icon: obj.data.icon,
actions: [
{
action: 'coffee-action',
title: 'Coffee',
icon: ''
},
{
action: 'doughnut-action',
title: 'Doughnut',
icon: ''
}]
};
event.waitUntil(self.registration.showNotification("Hello world", options));
});