问题描述
我希望当视图加载时我的列表第一个元素应该被聚焦。我尝试了多个参考但没有奏效。附上我的代码。这是在父视图中呈现的子视图。
TodoDemo.View.TodoTemplateView = TodoDemo.View.PubSubView.extend({ tagName: 'li',className: 'mdl-list__item pk-nw-mdl-list-item note-template-item',
template: Handlebars.compile(
"<span id='listId' class='mdl-list__item-primary-content note-template-name'>{{name}}</span>"
),attributes: function () {
return {'data-id': this.model.attributes.id};
},initialize: function () {
this.todoPubSub = this.options.todoPubSub;
},render: function () {
this.$el.append(this.template(this.model.toJSON()));
return this;
},
});
在这里,我试图集中注意力。
$templateList.children().first().addClass('selected-list-element-key').focus();
$templateList 包含要呈现的
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)