sha*_*iao 4 javascript requirejs handlebars.js
paths: {
jquery: 'libs/jquery/jquery-min',
underscore: 'libs/underscore/underscore-min',
backbone: 'libs/backbone/backbone-optamd3-min',
handlebars: 'libs/handlebars/handlebars',
text: 'libs/require/text'
}
define([
'jquery',
'underscore',
'backbone',
'collections/todos',
'views/todos',
'text!templates/stats.html',
'common',
'handlebars'
], function ($, _, Backbone, Todos, TodoView, statsTemplate, Common, handlebars) {
//handlebars is null
console.log("handlebars is",handlebars);
Run Code Online (Sandbox Code Playgroud)
})
除了把手,其他人可以成功加载.为什么以及如何使handlbars成功加载.谢谢
Sim*_*ith 30
首先,我可以看到您是新手,但请尝试在您的问题中添加更多详细信息,以帮助其他人为您提供帮助.
从源头上看,我不认为Handlebars与AMD兼容,因此您需要自己填充它.像这样的东西:
requirejs.config({
shim: {
'handlebars': {
exports: 'Handlebars'
}
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9993 次 |
| 最近记录: |