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 mobile 将jQuery Mobile添加到Yeoman主干网项目_Jquery Mobile_Backbone.js_Requirejs_Yeoman - Fatal编程技术网

Jquery mobile 将jQuery Mobile添加到Yeoman主干网项目

Jquery mobile 将jQuery Mobile添加到Yeoman主干网项目,jquery-mobile,backbone.js,requirejs,yeoman,Jquery Mobile,Backbone.js,Requirejs,Yeoman,我是新来的约曼人,我正在建立一个带有官方主干网生成器的新项目。我使用以下命令添加了jQuery Mobile: bower install -save jquery-mobile 当我运行应用程序时,require.js会将我的所有jquery移动脚本报告为丢失。我读过这方面的帖子。我一定错过了一步,或者我的main.js设置错误 以下是my main.js的相关部分: require.config({ shim: { <...> jquerymobil

我是新来的约曼人,我正在建立一个带有官方主干网生成器的新项目。我使用以下命令添加了jQuery Mobile:

bower install -save jquery-mobile
当我运行应用程序时,require.js会将我的所有jquery移动脚本报告为丢失。我读过这方面的帖子。我一定错过了一步,或者我的main.js设置错误

以下是my main.js的相关部分:

require.config({
  shim: {
      <...>
      jquerymobileconfig: {
        deps: [
            'jquery'
        ]
      },
      jquerymobile: {
        deps: [
          'jquery',
          'jquerymobileconfig'
        ]
      }
  },
  paths: {
    jquery: '../bower_components/jquery/jquery',
    jquerymobileconfig: 'jqmconfig',
    jquerymobile: '../bower_components/jquery-mobile/js/jquery.mobile',
    backbone: '../bower_components/backbone/backbone',
    underscore: '../bower_components/underscore/underscore'
  }
});

require([
  'jquery', 'backbone', 'jquerymobile'
], function ($, Backbone) {
  Backbone.history.start();
});
require.config({
垫片:{
jquerymobileconfig:{
副署长:[
“jquery”
]
},
jquerymobile:{
副署长:[
“jquery”,
“jquerymobileconfig”
]
}
},
路径:{
jquery:“../bower_components/jquery/jquery”,
jquerymobileconfig:'jqmconfig',
jquerymobile:“../bower_components/jquery mobile/js/jquery.mobile”,
主干:“../bower_组件/主干/主干”,
下划线:“../bower_组件/下划线/下划线”
}
});
要求([
“jquery”、“主干”、“jquerymobile”
],函数($,主干){
Backbone.history.start();
});

我找到了问题的答案。不要安装bower jquery mobile项目,而是安装:

bower install -save jquery-mobile-bower
这是用于bower/Yeoman项目的jquery mobile的现成版本。然后在main.js中引用jquery mobile,如下所示:

jquerymobile: '../bower_components/jquery-mobile-bower/js/jquery.mobile-1.4.1.min',