javascript - 来自 Tracker 重新计算函数的异常:ReferenceError: $el is not defined
问题描述
尝试过滤某个用户发布的图像时出现以下错误:
Exception from Tracker recompute function:
meteor.js?hash=857dafb4b9dff17e29ed8498a22ea5b1a3d6b41d:1059 ReferenceError: $el is not defined
at destroyApi (stars_rating.js:98)
at Blaze.TemplateInstance.Template.starsRating.destroyed (stars_rating.js:132)
at template.js:124
at Function.Template._withTemplateInstanceFunc (template.js:493)
at fireCallbacks (template.js:120)
at Blaze.View.<anonymous> (template.js:226)
at fireCallbacks (view.js:276)
at Object.Tracker.nonreactive (tracker.js:603)
at view.js:273
at Object.Blaze._withCurrentView (view.js:533)
在这里找到我点击用户名时写的js点击事件:
'click .js-set-image-filter': function(event){
Session.set("userFilter", this.createdBy);
}
在这里找到模板帮助代码:
images: function(){
if(Session.get("userFilter")){
return TasksCollection.find({createdBy:Session.get("userFilter")},{sort :{cretedOn:-1 ,rating:-1}});
}
else{
return TasksCollection.find({},{sort :{cretedOn:-1 ,rating:-1}});
}
},
在这里找到模板代码:
<template name="hello">
{{#if currentUser}}
<button class="js-show-image-form btn btn-success">show</button>
{{/if}}
<div class="row">
{{#each images}}
<div class="col-xs-6 col-md-3" id="{{_id}}">
<div class="thumbnail">
<img class="js-image crop-img" src="{{img_src}}" alt="{{imd_alt}}"/>
<div class="caption">
<h3>Rating : {{rating}}</h3>
<p>{{imd_alt}}</p>
<p> User:
<a href="#" class="js-set-image-filter"> {{getUser createdBy}} </a>
</p>
<p> {{>starsRating mutable=true class="js-rate-image" id=_id}}</p>
<button class="js-del-image btn btn-warning">Delete</button>
</div>
</div>
</div>
{{/each}}
</div>
</template>
解决方案
我已经弄清楚了一半,但我不确定如何完全解决它。Tracker 错误的异常是由在
<a href="" class="js-set-image-filter">{{getUser createdBy}} .
Now 的 href 中使用“#”引起的,当我单击用户时,我的页面会闪烁并重置为所有图像,这似乎完全是另一个问题。
推荐阅读
- visual-studio-code - Visual Studio Code Jupyter Scratchpad
- python - 有没有办法创建一个使用调度功能轮换的时间表?
- c# - RefIt C#中的动态参数添加
- javascript - 通过请求 html (python) 找不到脚本标记内容
- r - 晶格中 geom_label 的等价物是什么?
- scala - 使用 Actor 作为我的 Websocket 客户端流的源
- javascript - 如何在圆环图 Js 中添加中心文本
- java - 从 jsp 页面调用时找不到 HTTPServlet
- r - 将 15 添加到 R 中的列的每个数字
- questdb - QuestDB:在插入新记录之前,使用 PostgreSQL 协议的最后插入的行不会显示在 SELECT 查询的结果中