今天遇到这个问题,解决不了。我有 html 模板 -
<script type="text/template" id="usersettings">
<div class="page-header">
<h3></h3>
</div>
</script>
并且在尝试编译并将代码附加到文档时
var torender = $('#usersettings').html();
var source = Handlebars.compile(torender);
var html = source();
$('#contant').html(html);
从控制台收到此错误
Uncaught [object Object] handlebars.min.js:25
Handlebars.compile handlebars.min.js:25
Backbone.Router.extend.Settings routes.js:56
(anonymous function) backbone.js:1247
(anonymous function) backbone.js:1452
j.some.j.any underscore.js:208
h.extend.loadUrl backbone.js:1450
h.extend.start backbone.js:1416
(anonymous function)
有趣的是,如果我尝试直接从控制台执行此操作,一切正常。