【问题标题】:Send multiple data in javascript在javascript中发送多个数据
【发布时间】:2018-08-05 18:41:20
【问题描述】:

代码

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'的错误......我猜错误在于分离了2个数据......有人可以帮助我吗

【问题讨论】:

标签: javascript android firebase push-notification


【解决方案1】:

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
}
};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-27
    • 1970-01-01
    • 1970-01-01
    • 2019-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-10
    相关资源
    最近更新 更多