我有两个需要配置(两个上下文),如下所示:
var requirePortal = require.config({
context: 'portal',
baseUrl: '',
paths: {
'jquery': 'assets/js-vendors/jquery/dist/jquery',
'underscore': 'assets/js-vendors/underscore/underscore',
'backbone': 'assets/js-vendors/backbone/backbone',
// ...
}
});
var requireSample = require.config({
context: 'sample',
baseUrl: '<adress>/other-context',
paths: {
'viewFactory': 'application/util/ViewFactory',
'indicador': 'application/models/indicador'
}
});
此处门户上下文将包含所有供应商组件,示例上下文将包含用例模块。然后我必须从样本上下文中加载供应商组件:
define([
'indicador'
], function(IndicadorModel) {
var IndicadorPagerCollection = PagerCollection.extend({
model: IndicadorModel,
baseUrl: 'rest/manter/indicadores'
});
return IndicadorPagerCollection;
});
在这种情况下,PagerCollection
是供应商组件,位于门户网站上下文中。我怎么能这样做?