用JavaScript发送多个数据

时间:2018-08-05 18:41:20

标签: javascript android firebase push-notification

代码

const payload ={
notification: {
title: '${userName}',
body: "You have recieved a new Message",
icon: "default",
click_action : "com.appmaster.akash.messageplus_TARGET_NOTIFICATION"
},
data : {
         from_user_id : from_user_id;
         from_user_name : userName
}
};

获取“,”的意外令牌 但是当我删除它时,我收到'from_user_name'的错误消息...我猜错误在于分隔两个数据...有人可以帮帮我吗

1 个答案:

答案 0 :(得分:0)

JSON格式如下:

const payload ={
notification: {
title: '${userName}',
body: "You have recieved a new Message",
icon: "default",
click_action : "com.appmaster.akash.messageplus_TARGET_NOTIFICATION"
},
data : {
         from_user_id : from_user_id,
         from_user_name : userName
}
};