草庐IT

ember-view

全部标签

javascript - 如何在 Vue js 中使用其名称获取 View 或组件对象?

Javascript代码:varmain=newVue({el:"#main",data:{currentView:"top",},});vartopComponent=Vue.component('top',Vue.extend({template:"#top",}));现在,当我访问main.currentView时,我得到“top”。但是对于这个字符串'top',我如何获取组件topComponent? 最佳答案 来自VueJSguideDespitetheexistenceofpropsandevents,sometimes

Javascript 到 Django views.py?

这听起来很简单,但是如何将index.html模板中的Javascript数组中的数据发送到views.py?当用户单击“推荐”按钮时,我的代码会调用一个函数来访问我的数据库并在模板上打印一个名称。defindex(request):if(request.GET.get('Recommend')):sql_handler.recFunc()context['name']=sql_handler.namereturnrender(request,'polls/index.html',context)我在Javascript中有一组复选框值,这些值是在用户按下“推荐”后计算的。我想将它发送

javascript - 测试 : You will need to wrap any code with asynchronous side-effects in a run 时出现 Ember 错误

我们已经有一个应用程序正在运行,只是为了CI的目的向它添加测试用例。我们有一个小代码来尝试登录过程并检查在可能的登录状态(如成功、失败、无效帐户帐户被锁定等)之后发生的情况。所以我尝试了以下代码。visit('/login').fillIn('#identification',"testuser").fillIn('#password',"testpass").click('input[type="submit"]')andThen(function(){ok(!exists('button:contains(signin)'),'3.Loginbuttonisnotdisplayed

javascript - 引用 Backbone View 的子元素

刚刚渲染了一个像这样的View:render:function(){this.$el.html(this.template(this.model.toJSON()));returnthis;},如何引用模板的子元素之一并对其应用jQuery函数? 最佳答案 主干View公开adollar$function这将在幕后使用jQuery,但在View本身的上下文中。this.$('.child_element_of_my_view_template')即使View已分离($el不在DOM中),这也会起作用,但显然只有当您要选择的元素存在于

javascript - 在 Ember.js 中渲染应用程序之前等待模型加载

我有许多不同的应用程序级模型——即当前用户、当前帐户等——我想在呈现我的应用程序之前加载它们。这应该如何以及在哪里完成?Thisquestion/answer帮助很大,但它没有涵盖异步方面。下面的代码完成了我想要的,但是在beforeModel中加载模型(利用它等待promise解决)似乎不正确。我是否应该在ApplicationRoute中加载这些模型?App.ApplicationController=Ember.Controller.extend({currentAccount:null});App.ApplicationRoute=Ember.Route.extend({bef

javascript - Uncaught Error : Could not find module `ember` imported from `ui/app` loader. js:164

我使用以下命令构建并提供我的ember应用程序:ember构建Ember服务两者都按预期工作。然后我转到以下localhost:4200URL来查看应用程序并在javascript控制台中看到以下错误:UncaughtError:AssertionFailed:EmberViewsrequirejQuerybetween1.7and2.1ember.debug.js:5921UncaughtError:Couldnotfindmodule`ember`importedfrom`ui/app`loader.js:164不太确定为什么找不到jquery或ember模块?Ember版本:ve

javascript - Intersection Observer API 触发回调,即使元素不在 View 中

我正在尝试查找元素何时出现在屏幕上(尝试实现无限加载器)。为列表中的最后一项绑定(bind)观察者并收听,不幸的是在chrome62mac10.10中,即使我正在观察的元素不在视口(viewport)中,回调也会触发。当我检查相交率时,我可以很容易地阻止它。这是IntersectionObserver的工作方式吗?在此先感谢您的帮助。bindIO();functionioCallback(entries,observer){console.log("entries");console.log(entries);entries.forEach(entry=>{//Eachentrydes

javascript - 在 Ember.js 中创建分组选择

使用Ember.Select在Ember.js中创建选择相对容易.问题是,如何使用optgroup将其变成分组选择。我不认为这是内置的,但我猜对模板进行一些修改是可能的。 最佳答案 Ember现在原生支持它,但有一些问题。在1.4.0中,以下解决方案有效...这是示例数据:foos:Ember.A([{value:'foo',label:'Foo',group:'Foos'},{value:'bar',label:'Bar',group:'Bars'},{value:'bar2',label:'Bar2',group:'Bars'}

javascript - 无法使用带有解析存在 View 模型的 ko.mapping.fromJSON 解析绑定(bind) js 错误

我想以JSON格式将View模型保存在隐藏字段中。一切正常。但是当我尝试获取它时-我得到错误:UncaughtError:Unabletoparsebindings.Message:ReferenceError:selectAllisnotdefined;Bindingsvalue:checked:AllCheck,click:selectAllJsFiddlerView模型functionAppViewModel(){//Weekthis.AllCheck=ko.observable(false);this.DaysOfWeekResult=ko.observableArray();

javascript - ember-data - store.find ('model' ) 总是查询服务器

详细信息:ember-data-1.0.0.beta.3和默认的RESTAdapter我可能误解了store.find()方法的工作原理,但是,据我了解,如果我要查询的记录已经存在于商店:varIndexRoute=Em.Route.extend({model:function(){returnthis.store.find('link');},});来自DS.Store.find()的emberjs.com文档:Thefindmethodwillalwaysreturnapromisethatwillberesolvedwiththerecord.Iftherecordwasalre