我已经为我的一个使用框架的项目更新了dojo。在最近的更新之后,我注意到一个奇怪的错误"未捕获字符串"。"替补找不到钥匙!"actionBarTemplate" in template "和dojo load失败。我试着在网上搜索这个错误,并从源文件中进行跟踪,但无法找出原因。如果你们中有人知道为什么会发生这种情况,或者遇到过类似的情况,请告诉我。谢谢!
如果dijit/_TemplatedMixin
找不到存在于模板中但不在小部件中,恰好在小部件的buildRendering
中调用的_stringRepl
函数中,则抛出此错误。
返回这个函数:
return string.substitute(tmpl, this, function(value, key){
if(key.charAt(0) == '!'){ value = lang.getObject(key.substr(1), false, _this); }
if(typeof value == "undefined"){ throw new Error(className+" template:"+key); }
if(value == null){ return ""; }
注意throw new Error
部分?
现在,包含键!actionBarTemplate
的模板只有
——dijit templates TooltipDialog.html
——dijit templates Dialog.html
那么,你有一个使用这个模板的小部件,没有属性actionBarTemplate
吗?可能添加属性actionBarTemplate: ""
的小部件解决您的问题。
请记住,如果你的模板中有${title}
,这将最终询问this.title
是否存在,所以,确保至少有title: null
希望有所帮助