n1m*_*mmy 16
Meteor目前没有受支持的方式在服务器上使用cookie.
但是,您可以在客户端上使用cookie.以下是用户首次访问网页时显示启动画面的代码段:
Meteor.startup(function () {
if (!document.cookie.match("splash="))
$('body').append(Meteor.ui.render(Template.splash));
});
Template.splash.events = {
'click .submit': function () {
document.cookie = "splash=ack;expires=Sat, 23 Mar 2013 00:00:0 GMT";
$('#splash_outer').remove();
}
};
Run Code Online (Sandbox Code Playgroud)
您可以使用类似的方法并在客户端代码中设置cookie,然后在方法调用中将结果发送到服务器.
| 归档时间: |
|
| 查看次数: |
5502 次 |
| 最近记录: |