在用户(Meteor.loginWithPassword()或Accounts.createUser两个客户端)记录用户或创建新用户之后,我可以在他们的回调中确认Meteor.user()确实包含所有设置记录的属性.
{ _id: "XXX",
profile: {
name: "Joe Shmoe",
thumbnail: "http://www.YYY.com/ZZZ.jpg"
},
username: "joeshmoe" }
Run Code Online (Sandbox Code Playgroud)
此外,根据官方文件,
默认情况下,当前用户的用户名,电子邮件和个人资料将发布到客户端.
那么,当我尝试在我的模板中访问这些字段时,是否有人能够说出原因
Template.login.user_name = function () {
return (Meteor.userId() ? Meteor.user().profile.name : '')
};
Run Code Online (Sandbox Code Playgroud)
它失败了,因为Meteor.user()只返回{_id: "XXX"}没有它的实际属性?即用户肯定已登录,但用户对象突然丢失/正在隐藏其所有属性.
谁知道问题可能是什么?
非常感谢.
编辑: 这发生在Meteor 0.5.4,这是撰写本文时的最新版本.接受的答案确实解决了这个问题; 有时Meteor.userId()在Object的其余部分从服务器到达之前已经有效.感谢大家.
要垂直对齐tspan元素的内部text在SVG,CSS属性元素alignment-baseline,并dominant-baseline在Chrome和FF,分别工作的伟大.到现在为止还挺好.
使用Internet Explorer它有点疯狂:
alignment-baseline支持alignment-baseline以及dominant-baseline为tspan,但他们没有任何价值的工作对于IE9来说这不是一个问题(人们可能只是破解了所需的对齐),但由于我想摆脱浏览器检测,我想知道:
谢谢!
我正在获取一组记录并将它们放在一个模板中,让它们渲染{{#each}},我想显示一个加载图标,直到最后一个DOM节点被渲染.
我的问题是我还没有找到一种方法来查询状态/触发最后一个项目的回调,也就是要更新/重新绘制的最后一个DOM节点.
在我的HTML文件中看起来有点像这样:
<template name="stuff">
{{#each items}}
<div class="coolView">{{cool_stuff}}</div>
{{/each}}
</template>
Run Code Online (Sandbox Code Playgroud)
在客户端JS文件中:
// returns all records of Stuff belonging to the currently logged-in user
Template.stuff.items = function () {
Session.set('loading_stuff', true);
return Items.find({owner: Meteor.userId()}, {sort: {created_time: -1}});
};
Template.stuff.rendered = function() {
// every time something new is rendered, there will have been loading of the DOM.
// wait a short while after the last render to clear any loading indication.
Session.set('loading_stuff', true);
Meteor.setTimeout(function() {Session.set('loading_stuff', false);}, 300);
}; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用pip(easy_install抛出完全相同的错误)在Ubuntu 12.04.2 LTS上安装pysox包.
$ pip install pysox
[...]
building 'pysox.sox' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pysox/sox.c -o build/temp.linux-x86_64-2.7/pysox/sox.o
pysox/sox.c:227:17: fatal error: sox.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我的系统安装了:
$ dpkg --list | grep sox
ii libsox-fmt-all 14.3.2-3 All SoX format libraries
ii libsox-fmt-alsa 14.3.2-3 SoX alsa format I/O library
ii libsox-fmt-ao 14.3.2-3 SoX Libao format I/O library
ii libsox-fmt-base 14.3.2-3 Minimal set of SoX format libraries
ii libsox-fmt-ffmpeg 14.3.2-3 SoX ffmpeg format …Run Code Online (Sandbox Code Playgroud)