【问题标题】:1.9 upgrade: can not parse dojoType widgets1.9 升级:无法解析dojoType widgets
【发布时间】:2013-11-12 16:30:15
【问题描述】:

我正在从 1.8.3 升级到 1.9.1。构建顺利,但页面加载存在问题...加载时,dojo 无法解析 HTML 模板中的任何 dojoType 小部件。普通 DOM 节点还有其他附加点,这些附加点是可访问的,但 dojoType 节点的附加点是未定义的。我浏览了 1.9 的更改 here,但运气不佳。有人有类似经历吗?

这是堆栈跟踪:

myproj/views/_Home.js  <---- crashes here while attempting to 
                             read a widget's attach point in the template
dijit/_WidgetBase.js: line 541
dojo/_base/declare.js: line 203
dijit/_WidgetsInTemplateMixin.js: line 107
dojo/_base/declare.js: line 203
myproj/views/_Home.js: line 26 <--- Page loads with this widget... This is a 
                                    templated widget, and this line is the     
                                    this.inherited(arguments) of startup().

Dojo 在头部加载:

    <script type="text/javascript" src="/static/tara/config.js?1384202981691"></script>
    <script type="text/javascript">
        var $appBaseUri = 'http://cms.mydemo.com';
        var dojoConfig = {
            parseOnLoad: false,
            dojoBlankHtmlUrl: "/static/cms/blank.html",
            uploaderPath: "/static/nocache/uploader.swf",
            locale: "en-gb",
            cacheBust: "1384202981691",
            debugAtAllCosts: true,
            isDebug: true,
            packages: $appconfig.devMode.packages               
        }
    </script>       
    <script type="text/javascript" src="/static/lib/dojo/dojo/dojo.js?1384202981691"></script>
    <script type="text/javascript">
        dojo.require("myapp._dojo");
        dojo.addOnLoad(function(){
            dojo.require("myapp._base");
            dojo.addOnLoad(function(){
                dojo.require("cms.models._all");
                dojo.require("cms._base");
            });
        });
    </script>

正在渲染的模板,home.html 下面。所有其他附加点都可以访问,但不能访问“mainStack”和“windows”。

<div class="container" title="">
    <div dojoAttachPoint="header">
    <div dojoAttachPoint="headerInner">
        <div dojoAttachPoint="topNavNode">
        </div>
        <div dojoAttachPoint="mainDetails"></div>
        <div class="clear"></div>
        </div>
    </div>
    <div dojoAttachPoint="mainStack" dojoType="dijit.layout.StackContainer"></div>
</div>
<div dojoAttachPoint="windows" dojoType="myapp.layout.WindowContainer"></div>

【问题讨论】:

  • 没有看到有问题的 HTML,这很难回答。
  • 我在 中添加了 html 和 dojo 加载。
  • 您将不得不提供更多细节。您如何尝试访问这些连接点?显示一些代码。实际错误是什么? “崩溃”不是错误。
  • 我解决了这个问题的问题。覆盖 dijit/_Templated.js 的模块中存在的问题,它需要适应 1.9.1 中的变化,即弃用 _Templated 并引入 _AttachMixin。

标签: dojo


【解决方案1】:

您的问题相当含糊,但我会在这里冒个险,假设您只需将dojoType 属性改为data-dojo-type 即可...对于附加点等类似:

<div id="homeView" data-dojo-type="myproj/views/_Home" data-dojo-props="someProp:'someValue'"></div>

在您的小部件模板中:

<div>
    <div data-dojo-attach-point="someAttachPoint">...</div>
    ...
</div>

这就是你要找的吗?

【讨论】:

  • 不,data-dojo-type 等无济于事。还有其他用于纯 HTML 节点的 dataAttachPoints,它们是可访问的。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-07-23
  • 2016-02-18
  • 2017-09-26
  • 2022-12-21
  • 2018-11-20
  • 2022-01-17
  • 2018-04-01
相关资源
最近更新 更多