我想通过模板传递数据,但我得到未定义我在客户模板中有两个变量,当用户单击时,我想将这两个 var 传递给下一个模板 customerchathistory,例如
Template.customer.events({
async 'click .list-chat'(event,template) {
const Rid = event.currentTarget.id;
const Rtoken = event.currentTarget.token;
}
})
在这里,我在 customer.html 中传递了像这样的变量
{{>cutomerChatHistory clickRid= Rid clickRtoken = Rtoken }}
现在,当我在 customerChatHistory.js 中获取这两个变量时,我变得未定义
Template.customerChatHistory.onCreated(function() {
const currentData = Template.currentData();
console.log(currentData.clickRid , currentData.clickRtoken) //giving undefined here
})