我得到了这个代码
{
"_id": "_design/test",
"_rev": "10-651aa6314effdad0bca00fc4a3da38f6",
"views": {
"foo": {
"map": "(function(doc){ emit(doc._id, doc._rev)})"
},
"bar": {
"map": "(function(doc){if(doc.date && doc.title) {emit(doc.date, doc.title);})"
}
}
}
Run Code Online (Sandbox Code Playgroud)
为什么它返回:
表达式不求值为函数。((new String("(function(doc){if(doc.date && doc.title) {emit(doc.date, doc.title);})")))
我目前正在使用emberjs来构建一个应用程序,我接近完成但我有一些与应用程序中的视图相关的didInsertElement方法相关的不一致.这是代码:
didInsertElement : function(){
Ember.run.next(this,function(){
var sub = this.$(document).find('.sub_t');
$(sub).not('button').siblings('.inside').toggle();
$(sub).each(function(i){
$(this).attr('id','s_t' + i + '');
var s_t = $(this).nextUntil(".sub_t");
$(s_t).not('button').wrapAll("<div class='s_t" + i + "'></div>");
});
});
},
Run Code Online (Sandbox Code Playgroud)
问题是,即使我没有使用Ember.run.next,应用程序视图反应也不一致.我只是想在我的视图中修改内容.有时jquery工作有时它不是,并且不清楚如何重现这个bug.
它是否与加载文件的大小有关?或者是滥用Ember运行循环还是插入元素方法?
有人提到了吗?或暗示正在发生的事情以及我可能会做些什么来解决这个问题?