ReactRouter 手机端报错 undefined


在pc上用chrome的移动端模拟器是正常的,没有问题,渲染出来一切正常。
但是一旦用手机访问就会有问题:
问题代码如下:


 var routes;
    try{
        routes = (
            React.createElement(Route, {handler: App}, 
            React.createElement(Route, {name: "homepage", handler: Homepage}), 
            React.createElement(Route, {name: "login", handler: Login}), 
            React.createElement(Route, {name: "list", handler: List}), 
            React.createElement(Route, {name: "detail", handler: Detail}), 
            React.createElement(Route, {name: "manage", handler: Manage}), 
            React.createElement(Route, {name: "mine", handler: Mine}), 
            React.createElement(DefaultRoute, {handler: Homepage}), 
            React.createElement(Redirect, {to: "homepage"})
            )
         );
    }catch(e){
        alert(e);
    }

在catch的地方弹出来的错误是:ReferenceError:Homepage is not defined

什么问题这个是?
在pc上看什么错都没有。
关于router的变量都没问题:


 var Router = ReactRouter;
var Route = ReactRouter.Route; 
var RouteHandler = ReactRouter.RouteHandler;
var Link = ReactRouter.Link;
var StateMixin = ReactRouter.State;
var Redirect = ReactRouter.Redirect;
var DefaultRoute = ReactRouter.DefaultRoute;

reactjs 前端 JavaScript

MoRod 9 years, 3 months ago

原来是js依赖问题。已解决。

逆袭的夏亚 answered 9 years, 3 months ago

Your Answer