Meteor不更新辅助函数。它返回vales但不更新。
Template.recrutersubscription.helpers({
renderskills: function ()
{
console.log(">>>>>>>>>>skilldropdown");
console.log(Session.get('skilldropdown'));
return Session.get('skilldropdown');
}
});
这是我的Html代码
<select id="example-multiple-requiredskill" multiple="multiple">
<optgroup label="Skills">
{{{renderskills}}}
</optgroup>
</select>
答案 0 :(得分:0)
您确定正确使用无功变量吗?这些数据来自哪里?
请务必遵循以下路径:
var reactiveWhatever = new ReactiveVar({});
template.onCustomCreated = function() {
return reactiveWhatever.set({
whatever: true
});
};
Template.recrutersubscription.helpers(
renderskills: function ()
{
console.log(">>>>>>>>>>skilldropdown");
console.log(Session.get('skilldropdown'));
return reactiveWhatever.get('skilldropdown');
}
);
然后在HTML
中<select id="example-multiple-requiredskill" multiple="multiple">
<optgroup label="Skills">
{{{renderskills}}}
</optgroup>
</select>