Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Knockout.js 带热毛巾模板的Dropzone控制(击倒和Durandal)_Knockout.js_Requirejs_Durandal_Hottowel_Dropzone.js - Fatal编程技术网

Knockout.js 带热毛巾模板的Dropzone控制(击倒和Durandal)

Knockout.js 带热毛巾模板的Dropzone控制(击倒和Durandal),knockout.js,requirejs,durandal,hottowel,dropzone.js,Knockout.js,Requirejs,Durandal,Hottowel,Dropzone.js,我在热毛巾模板中加载Dropzone控件时遇到了一个问题,我使用了Dropzone amd模块,并将其作为依赖项包括在内 require.config({ paths: { 'text': '../Scripts/text', 'durandal': '../Scripts/durandal', 'plugins': '../Scripts/durandal/plugins', 'transitions': '../Scri

我在热毛巾模板中加载Dropzone控件时遇到了一个问题,我使用了Dropzone amd模块,并将其作为依赖项包括在内

require.config({
    paths: {
        'text': '../Scripts/text',
        'durandal': '../Scripts/durandal',
        'plugins': '../Scripts/durandal/plugins',
        'transitions': '../Scripts/durandal/transitions',
        'dropzone': '../Scripts/dropzone-amd-module'

    }
});
在我的dashboard.js中

define(['services/logger','dropzone'], function (logger,Dropzone) {
    var title = 'Home';
    var vm = {
        title: title
    };

    return vm;

    //#region Internal Methods
    function activate() {

           Dropzone.options.dropzoneJsForm = {

            //prevents Dropzone from uploading dropped files immediately
            autoProcessQueue: false,

            init: function () {
                var submitButton = document.querySelector("#submit-all");
                var myDropzone = this; //closure

                submitButton.addEventListener("click", function () {
                    myDropzone.processQueue(); //tell Dropzone to process all queued files
                });

            },
            addRemoveLinks: true

        };
        logger.log(title + ' View Activated', null, title, true);
        return true;
    }
});
但我犯了这个错误

未捕获错误:未能加载路由模块仪表板/仪表板。 详细信息:尚未为上下文加载模块名发射器。\ux。 使用require[]


我按照这些步骤来解决这个问题

1-在索引页中的require.js之前包含dropzone.js脚本 2-不要将其包含在main.js中,因为需要配置依赖关系 3-在附加事件中以编程方式创建dropzone元素,如下所示

 function attached(view) {
        var myDropzone = new Dropzone("#dropzoneJsForm", { url: "/file/post", autoProcessQueue: false });
    }
define(['services/logger'], function (logger) {
    var title = 'Details';


    var vm = {
        activate: activate,
        title: title,
        attached: attached,
    };

    return vm;

    function attached(view) {
        var myDropzone = new Dropzone("#dropzoneJsForm", { url: "/file/post", autoProcessQueue: false });
    }

    //#region Internal Methods
    function activate() {


       logger.log(title + ' View Activated', null, title, true);
        return true;
    }
});
因此,我的控制器如下所示

 function attached(view) {
        var myDropzone = new Dropzone("#dropzoneJsForm", { url: "/file/post", autoProcessQueue: false });
    }
define(['services/logger'], function (logger) {
    var title = 'Details';


    var vm = {
        activate: activate,
        title: title,
        attached: attached,
    };

    return vm;

    function attached(view) {
        var myDropzone = new Dropzone("#dropzoneJsForm", { url: "/file/post", autoProcessQueue: false });
    }

    //#region Internal Methods
    function activate() {


       logger.log(title + ' View Activated', null, title, true);
        return true;
    }
});