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
Backbone.js 将iscroll v5与requirejs一起使用_Backbone.js_Requirejs_Iscroll_Iscroll4 - Fatal编程技术网

Backbone.js 将iscroll v5与requirejs一起使用

Backbone.js 将iscroll v5与requirejs一起使用,backbone.js,requirejs,iscroll,iscroll4,Backbone.js,Requirejs,Iscroll,Iscroll4,我和你有一个项目 我想包括 但我不知道如何加载它并用requirejs初始化它 我已经试图在项目的任何分支中找到解决方案,但到目前为止我什么也没找到 我是JS的新手,因此我需要一些帮助,任何人都可以发布一个示例或提供一个简单的演示?您可以在配置文件中包含iscroll插件的路径,在其中声明其他文件的依赖项和路径 require.config({ locale: 'en_us', baseUrl: 'baseUrl', paths: { // Paths

我和你有一个项目

我想包括 但我不知道如何加载它并用requirejs初始化它

我已经试图在项目的任何分支中找到解决方案,但到目前为止我什么也没找到


我是JS的新手,因此我需要一些帮助,任何人都可以发布一个示例或提供一个简单的演示?

您可以在配置文件中包含iscroll插件的路径,在其中声明其他文件的依赖项和路径

require.config({
    locale: 'en_us',

    baseUrl: 'baseUrl',
    paths: {
        // Paths of the libraries being used
        'Iscroll' : 'relative path to the file',
        ......
        ......  Other files
    },
    shim : { // If the library does not support AMD
        'Iscroll': {
             exports: 'Iscroll'
         },
    }
});
现在,如果您想在特定模块中使用它,只需将其包括在内

define(['Iscroll', other args], function(Iscroll, other args) {

});

您可以在配置文件中包含iscroll插件的路径,在其中声明其他文件的依赖项和路径

require.config({
    locale: 'en_us',

    baseUrl: 'baseUrl',
    paths: {
        // Paths of the libraries being used
        'Iscroll' : 'relative path to the file',
        ......
        ......  Other files
    },
    shim : { // If the library does not support AMD
        'Iscroll': {
             exports: 'Iscroll'
         },
    }
});
现在,如果您想在特定模块中使用它,只需将其包括在内

define(['Iscroll', other args], function(Iscroll, other args) {

});

谢谢但是现在我如何初始化一个新的Iscroll对象并传递div id呢?我总是收到一个错误,因为Iscroll无法访问id始终为null…在模板中的元素附加到DOMColl后,在render方法中执行此操作。但是现在我如何初始化一个新的Iscroll对象并传递div id呢?我总是收到一个错误,因为Iscroll无法访问id始终为null…在模板中的元素附加到DOM后,在render方法中执行此操作