嘿,我一直在学习 RactiveJS,到目前为止我真的很喜欢它。我想将它与 RequireJS 一起使用,发现: https ://github.com/Rich-Harris/Ractive/wiki/Using-Ractive-with-RequireJS
但是,它没有显示 html 模板或任何代码是如何实现的。这是我迄今为止最好的:
(function () {
requirejs.config({
baseUrl: 'js',
});
require(['alerter', 'Ractive'], function (alerter, Ractive) {
alerter.showMessage();
Ractive = new Ractive({
el: 'container',
template: "{{greeting}} {{recipient}}!",
data: {
'greeting': alerter.showMessage(),
'recipient': 'mike'
}
});
});
})();
所以上面的代码可以工作,但你必须明确地把你想要的代码位作为模板。
上面的链接中是否有代码的工作示例?或另一个示例,该示例显示如何将 require 与 ractive 一起使用,但不必在模板对象中硬编码胡须。
感谢您的帮助。