Emberjs:获取当前元素 [英] Emberjs: Get the current element
本文介绍了Emberjs:获取当前元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找类似于 的
jQuery
的内容。我将在下面的代码中列出:
I am looking for something that's similar to the this
of jQuery
. I'm going to list below the code I have:
<script type="text/x-handlebars" data-template-name="uiMainContainerTaskList">
<div class="uiMainContainerTaskListContent">
{{#view App.TasksView}}
{{#each App.tasksController.tasks}}
<div class="uiMainContainerWideItem" {{action "taskClick" target="TasksView" on="click"}}>
<div class="uiMainContainerWideItemCheckbox">{{view Em.Checkbox checkedBinding="isDone"}}</div>
<div class="uiMainContainerWideItemText uiMainContainerWideItemTaskName">{{taskName}}</div>
<div class="uiMainContainerWideItemText uiMainContainerWideItemTaskDescription">{{taskDescription}}</div>
<div class="uiMainContainerWideItemText uiMainContainerWideItemTaskPriority">{{priority}}</div>
<div class="uiMainContainerWideItemText uiMainContainerWideItemTaskDueDate">{{dueDate}}</div>
</div>
{{/each}}
{{/view}}
</div>
</script>
我将 taskClick
code> div.uiMainContainerWideItem 。在我的查看
我有:
I bind the taskClick
action to the div.uiMainContainerWideItem
. In my View
I have:
App.TasksView = Em.View.extend({
templateName: 'uiMainContainerTaskList',
taskClick: function(e) {
console.log($(this));
}
});
在 jQuery
, $(this)
将是当前元素(无子元素)。有没有办法获得Ember中的当前元素?
In jQuery
, $(this)
would be the current element (no children). Is there a way to get the current element in Ember as well?
推荐答案
我相信你在寻找 this $()
。
I believe you are looking for this.$()
.
这篇关于Emberjs:获取当前元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文