在流星开始时未定义位置

时间:2017-07-10 04:26:05

标签: meteor

当我运行meteor时,它说“位置未定义”

// redirect on start to dashboard on file protocol
if(location.origin === 'file://') {
    FlowRouter.wait();
    FlowRouter.initialize({hashbang: true});

    Meteor.startup(function() {
        FlowRouter.go('dashboard');
    });
}

2 个答案:

答案 0 :(得分:0)

您的意思是window.location.origin吗?

Documentation

答案 1 :(得分:0)

https://github.com/TylerL-uxai/decentralized-website

我用if语句

解决了这个问题
// redirect on start to dahsboard on file protocol
if (typeof location != 'undefined') {
  if(location.origin === 'file://') {
      FlowRouter.wait();
      FlowRouter.initialize({hashbang: true});

      Meteor.startup(function() {
          FlowRouter.go('whatIdo');
      });
  }
}