Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.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
Jquery Underline.js-如何识别javascript依赖关系?_Jquery_Backbone.js_Underscore.js - Fatal编程技术网

Jquery Underline.js-如何识别javascript依赖关系?

Jquery Underline.js-如何识别javascript依赖关系?,jquery,backbone.js,underscore.js,Jquery,Backbone.js,Underscore.js,我在我的移动应用程序项目中使用backbone.js和下划线.js。我的问题是如何识别每个文件的javascript依赖关系?我尝试使用下面的代码,但仍然无法在浏览器中工作 require.config({ waitSeconds: 0, //path mappings for module names not found directly under baseUrl paths: { jquery: 'vendor/jqm/jquery_1.7_min'

我在我的移动应用程序项目中使用backbone.js和下划线.js。我的问题是如何识别每个文件的javascript依赖关系?我尝试使用下面的代码,但仍然无法在浏览器中工作

require.config({
    waitSeconds: 0,
    //path mappings for module names not found directly under baseUrl
    paths: {
        jquery: 'vendor/jqm/jquery_1.7_min',
        jqm: 'vendor/jqm/jquery.mobile-1.4.0-rc.1',
        underscore: 'vendor/underscore/underscore_amd',
        backbone: 'vendor/backbone/backbone_amd',
        jqueryflexslider: 'vendor/lib/jquery.flexslider',
        shCore: 'vendor/lib/shCore',
        shBrushXml: 'vendor/lib/shBrushXml',
        shBrushJScript: 'vendor/lib/shBrushJScript',
        jqueryeasing: 'vendor/lib/jquery.easing',
        jquerymousewheel: 'vendor/lib/jquery.mousewheel',
        demo: 'vendor/lib/demo',
        text: 'vendor/require/text',
        plugin: 'plugin',
        main: 'main',
        messages: 'messages',
        templates: '../templates',
        modules: '../modules',
        model: '../model'
    },
    shim: {
        'backbone': {
            deps: ['underscore', 'jquery'],
            exports: 'Backbone'
        },
        'jquery': {
            exports: '$'
        },
        'jqm': {
            deps: ['jquery'],
            exports: '$'
        },
        'jqueryflexslider': {
            deps: ['jquery'],
            exports: '$'
        },
        'jqueryeasing': {
            deps: ['jquery'],
            exports: 'jQuery'
        },
        'jquerymousewheel': {
            deps: ['jquery'],
            exports: '$'
        },
        'demo': {
            deps: ['jquery'],
            exports: '$'
        },
        'main': {
            deps: ['jquery'],
            exports: '$'
        },
        'messages': {
            deps: ['jquery'],
            exports: '$'
        },
        'underscore': {
            exports: '_'
        },
    }
});
//1. load app.js, 
//2. configure jquery mobile to prevent default JQM ajax navigation
//3. bootstrapping application
define(['app', 'jqm-config'], function(app) {
    $(document).ready(function() {
        console.log("DOM IS READY"); // Handler for .ready() called.
    });
    app.initialize();
});
参考:


请告诉我。

这要看情况而定。我也是JavaScript新手。我使用VisualStudio作为我的IDE。要安装软件包,我在VisualStudio中使用NuGet软件包管理器。它基本上为您安装所有依赖项包

另一方面,您有两个很好的网站,如果您搜索包/库,它将为您提供有关包及其依赖项的最新信息

-搜索您需要的软件包 例:主干

-搜索您需要的软件包 例:数据表

通过这种方式,您可以找到配置amd的软件包的依赖项

如果不是你,希望这能帮助别人


快乐的Javascripting

看起来您正在使用AMD版本的主干和下划线。如果是,为什么要对其进行填隙?是的。但有时它工作,有时不工作。如果它不工作,您在控制台中看到任何错误吗?我看不到填充模块作为依赖项列在哪里。是否尝试将它们添加到define语句?例如,
define(['app','jqm config','jquery','backbone','jqm','jqueryflexslider',…])
尝试按文件名引用它们。