使用 Backbone.View 我曾经以这种方式获取外部模板(1)
如果我想使用 Backbone.Marionette.Layout 从外部文件中获取模板怎么办?(2)
(1)
define(['myTemplate.html'], function (myTemplate) {
var MyView = Backbone.View.extend({
render: function ()
{
this.$el.html(myTemplate, this.getView());
}
});
return MyView;
});
(2)
define(['myTemplate.html'], function (myTemplate) {
var Layout = Backbone.Marionette.Layout.extend({
template: "#container",
regions: {
top: "#top",
main: "#main"
}
});
return Layout;
});