我一直在尝试执行Port open
http://0.0.0.0:9091/
Recived: t
Waiting0
Serial < 1100D00H00M00S
Recived: t
Waiting0
Serial < 1100D00H00M00S
Recived: t
Waiting0
Serial < 1100D00H00M00S
Recived: t
Waiting0
Serial < 1100D00H00M00S
Recived: t
Waiting0
Serial < 1100D00H00M00S
Recived: t
来重新加载所有Facebook社交插件。我可以在FB.XFBML.parse();
中成功执行,但不能在Template.sample.events({})
或Template.sample.onRendered()
中执行,因为我收到的错误是Template.sample.rendered
未定义。我的代码如下:
FB
OR
Template.sample.onRendered(function() {
FB.XFBML.parse();
});
如何执行FB.XFBML.parse();每次加载模板?
答案 0 :(得分:0)
使用try-catch块包装方法。注意到rendered
被多次调用。第一次传递失败,表示FB未定义,而后续传递成功。
Template.sample.rendered = function() {
try {
FB.XFBML.parse();
} catch (e) {
// Will normally crash but succeeding execution will be successful
}
}