我不明白以下哪種方式在Ember工作流程中更有意義。什麼是清潔劑?如何在路線中使用`model`?
最好有一個model
像這樣的代碼?
應用程序/路由/ index.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return {
categories: this.store.find('category'),
products: this.store.find('product')
};
}
});
或者是更好地在此代碼不能使用model
都不像?
應用程序/路由/ index.js
import Ember from 'ember';
export default Ember.Route.extend({
categories: function() {
return categories: this.store.find('category')
},
products: function() {
return products: this.store.find('product')
}
});
或者是兩種方式很好,我不應該擔心嗎?