Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.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
meteor 1.0生产模式下的铁路由器错误_Meteor_Iron Router - Fatal编程技术网

meteor 1.0生产模式下的铁路由器错误

meteor 1.0生产模式下的铁路由器错误,meteor,iron-router,Meteor,Iron Router,我已将meteor应用程序从0.8升级到1.0。在生产模式下升级到1.0之前,它运行良好。升级后,我在生产模式中面临错误。 正如我在home.js中定义的那样 Router.map(function() { this.route('home', { path: '/', controller: 'Controller1' }); }); Controller1 = RouteController.extend({ layoutTemplate: 'Layout

我已将meteor应用程序从0.8升级到1.0。在生产模式下升级到1.0之前,它运行良好。升级后,我在生产模式中面临错误。 正如我在home.js中定义的那样

Router.map(function() {
  this.route('home', {
    path: '/', 
    controller: 'Controller1'
  });
});

Controller1 = RouteController.extend({  
  layoutTemplate: 'Layout1',      
  onAfterAction: function() {
     setTimeout(function(){  $('#l').focus(); }, 600);
     this.next;
  }  
});
在开发模式下,它工作得很好,但当我在生产模式下运行应用程序时,它给了我找不到的错误路径


请帮我摆脱它。提前谢谢。

我有一个像@Moshikaro一样的问题:

看看我的工作记事本

[编辑]

你的home.js应该是这样的

Controller1 = RouteController.extend({
  layoutTemplate: 'Layout1',
  name: 'home',
  onAfterAction: function() {
    Meteor.setTimeout(function() {
      $('#l').focus();
    }, 600);
  }
});

Router.map(function() {
  this.route('home', {
    path: '/',
    controller: 'Controller1'
  });
});

在迁移到meteor 1.0和iron:router 1.0之后,我不得不修改我的router.js文件。首先,我只包含了这个。接下来在onRun和onBeforeAction钩子中,您不需要将它放在onafaik中

此外,我不再使用Router.map,我根据文档定义所有路由:

因此,请尝试如下方式修改代码:

Router.route('home', function () {
  this.render('home');
}, {
  layoutTemplate: 'Layout1',
  path: '/',
  onAfterAction: function(){
    setTimeout(function(){  $('#l').focus(); }, 600);
  }
});

干杯,

您所说的开发模式和生产模式到底是什么意思?在这些模式之间切换所需的步骤是什么?在开发模式中意味着我运行meteor-p 3000,在生产模式中意味着meteor-p 3000-生产在开发模式中意味着我运行meteor-p 3000,在生产模式中意味着meteor-p 3000-生产模拟生产模式。缩小并捆绑CSS和JS文件。所以我认为你的javascript在那之后不能正常工作。你能发布你的错误日志吗?你试过我的Meteopad解决方案吗是的,它在控制台中没有显示任何错误,但在浏览器中它给出了iron路由器错误,如router.route'/',function{this.render'Home',{data:function{return Items.findOne{u id:this.params.{u id};};是的,我检查了你的解决方案,但没有找到任何答案。谢谢在我的回答中删掉我的编辑部分。将代码粘贴到您当前的home.js中,应该可以正常工作。如果没有,请将完整的错误代码粘贴到代码格式块中的新答案中。谢谢