Meteor 未定义的反应变量
我试图在我的一个表单中实现jqueryslider,并使用ReactiveVar跟踪它的值 代码: HTML 你知道为什么会这样吗Meteor 未定义的反应变量,meteor,Meteor,我试图在我的一个表单中实现jqueryslider,并使用ReactiveVar跟踪它的值 代码: HTML 你知道为什么会这样吗 非常感谢这是来自Autoform插件的错误。您的Template.requestPaymentForm.created中的所有初始化都将被放弃,并被Autoform.created覆盖。因此,它表示该变量在helper中未定义 我遇到了同样的问题,我正在等待autoform团队解决此问题。我的修复程序正在添加一个签入帮助程序,如果它为空,则为其赋值。希望这有帮助。这
非常感谢这是来自Autoform插件的错误。您的Template.requestPaymentForm.created中的所有初始化都将被放弃,并被Autoform.created覆盖。因此,它表示该变量在helper中未定义
我遇到了同样的问题,我正在等待autoform团队解决此问题。我的修复程序正在添加一个签入帮助程序,如果它为空,则为其赋值。希望这有帮助。这是我们目前正在处理的一个已知错误:@stubailo该错误来自autoform插件,Template.requestPaymentForm.created的所有初始化都将被没收-我应该检查一下@塔伦:你能在github上以可克隆应用程序的形式复制这个吗?然后我可以测试我对它的修复。
Template.requestPaymentForm.created = function() {
this.requestAmountValue = new ReactiveVar(0);
};
Template.requestPaymentForm.helpers({
selectedRequestAmount: function() {
var value = Template.instance().requestAmountValue.get() / 100;
return value;
},
...
Template.requestPaymentForm.events({
'slide #requestAmountSlider': function(event, template) {
var sliderValue = template.$("#requestAmountSlider").slider("option","value");
template.requestAmountValue.set(sliderValue);
},
});
<template name='requestPaymentForm'>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Request Payment</h4>
</div>
{{#autoForm collection="Payments" id="insertPaymentForm" type="method" meteormethod="createPayment"}}
<div class="modal-body">
<div class="amounts">
<span class="selected amount">Amount: {{formatMoney selectedRequestAmount}}</span>
<span class="available amount">Available: {{formatMoney availableForRequest}}</span>
</div>
<br>
<div id="requestAmountSlider"></div><br>
{{> afFieldInput name='amount'}}
</div>
<div class="modal-footer">
<button id="submitRequestPaymentForm" type="submit" class="btn btn-default btn-primary">Submit</button>
</div>
{{/autoForm}}
</div>
</template>
TypeError: Cannot read property 'get' of undefined
at Object.Template.requestPaymentForm.helpers.selectedRequestAmount