我需要在 Meteor 中动态创建模板的副本。副本应该具有相同的车把内容,但一组不同的帮助器、方法和事件处理程序。我怎样才能做到这一点?
我试过了:
Template.copy = function() {
return Template.original.apply(this, arguments);
}
它显示正确的 html,但生成的模板不是反应式的。另一方面,当我这样做时
Template.copy = function() {
return Meteor.render(Template.original.apply(this, arguments));
}
结果render
是一个DocumentFragment
我不知道如何正确转换为字符串或附加到 DOM 的对象。