我正在学习 meteor 并关注this链接。
当我使用 Session.set
时,它在控制台中给我错误 Session is not defined
客户端文件夹中的 main.js 文件代码如下
PlayersList = new Meteor.Collection('players');
if(Meteor.isClient) {
Template.leaderboard.events({
'click .playerName ': function(){
var playerId = this._id;
Session.set('selectedPlayer', playerId);
}
});
}
我不知道我做错了什么
我已经阅读了this发布。
我的文件在客户端文件夹中,代码也在 isClient
条件中。
它仍然给我错误。
最佳答案
默认情况下不再安装 session 包。你只需要运行:
meteor add session
关于javascript - meteor : session 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36355808/