本文介绍了Ember:在Mixin中编程设置queryParams的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mixin有一个方法,当控制器保持mixin被初始化时,该方法被调用。
c $ c> queryParams 的后期绑定是不可能的。I'm trying to programatically define queryParams in an Ember.Mixin.
The mixin has a method which is called when the controller holding the mixin is initialized.
setupQueryParams: (params) -> params.forEach (param) => @get('queryParams').push(param)Later in an action defined on the mixin I call @transitionToRoute({queryParams: {someParam: 'something'}}) nothing happens. However when I explicitly define my queryParams, this works.
解决方案queryParams are resolved off the proto of the class, not an instance, so any init functionality wouldn't be applied in time for ember to resolve it.
This just means late binding of the queryParams isn't possible in the way you want.
这篇关于Ember:在Mixin中编程设置queryParams的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!