Dojo加载失败,错误'未捕获字符串.替代品找不到关键字"在模板# 39;经过最近的dojo更新



我已经为我的一个使用框架的项目更新了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

希望有所帮助

最新更新