Dojo中的'Parser返回未填充的承诺'错误

str*_*ght 5 javascript dojo dijit.form

dojo/parser在我的代码中使用时出现以下错误.

parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin.

我有

define([
    "dojo/_base/declare",
    "dijit/_WidgetBase",
    "myApp/base/_TemplatedMixin",
    "dijit/_WidgetsInTemplateMixin",
    "dojo/text!../templates/MyTemplate.html",
    "dojo/i18n!../nls/Localized",
    "myApp/js/utils/hint",
    "dijit/form/ValidationTextBox",
    "dijit/form/SimpleTextarea",
    "dijit/form/Button",
    "dojo/parser",
    "dojo/domReady!"
], function (
    declare,
    _WidgetBase,
    _TemplatedMixin,
    _WidgetsInTemplateMixin,
    template,
    l10n,
    hint
) {

    'use strict';

    /**
     * @module
     */

    return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {

        widgetsInTemplate: true,

        /**
         * @description Localized object for view
         * @type {object}
         */
        l10n: l10n,

        /**
         * @description Custom template for view
         * @override
         */
        templateString: template,


        //postCreate: function () {
            //hint(l10n.hint);
        //}
    });

});
Run Code Online (Sandbox Code Playgroud)

我做了一些研究,并意识到它可能与依赖和秩序有关.我添加了widgetsIntemplate属性,但仍然没有骰子.这仅在首次加载页面时发生.

有人可以帮忙吗?

小智 8

如果您的模板中有小部件,则必须确保它们都已预先加载.确保您的定义包含模板中的所有小部件.