【发布时间】:2020-08-21 04:35:38
【问题描述】:
我想通过模板传递数据,但我得到未定义我在客户模板中有两个变量,当用户单击时,我想将这两个变量传递给下一个模板 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 中获取这两个 var 时,我变得未定义
Template.customerChatHistory.onCreated(function() {
const currentData = Template.currentData();
console.log(currentData.clickRid , currentData.clickRtoken) //giving undefined here
})
【问题讨论】:
-
请添加两个模板的 html 文件,否则不清楚您将哪些数据传递到哪里。
标签: javascript meteor meteor-blaze blaze