代码之家  ›  专栏  ›  技术社区  ›  laminatefish

React Router Link to=单击时尝试下载x.app.js

  •  0
  • laminatefish  · 技术社区  · 6 年前

    有人能解释为什么这个非常简单的路由器设置:

            <Router>
                <Switch>                
                    <Route exact path='/' component={Home} />
                    { this.props.loggedIn() &&
                        <div>
                            <Route exact path='/projects' component={Tools} />
                            <Route path='/project/:project_id' component={EditProject} />
                            <Route exact path='/calculator' component={Calculator} />
                        </div>
                    }                
                    <Route exact component={NotFound} />
                </Switch>
            </Router>
    

    还有一个简单的页面链接:

    <Link to={`/project/${proj.ID}`}><FontAwesomeIcon icon="pencil-alt" /></Link>
    

    当点击链接时 ):

    enter image description here

    编辑

    在有人认为project_id是infact x.app.js之前,这里是我正在使用的原始对象:

    {
        Coords: "2389572935"
        CustomerID: 0
        FacilityType: 0
        ID: 4
        Name: "Loki Testing New Project"
        UserID: 2
        VerifiedByBL: 0
        VerifiedByCustomer: 0
    }
    
    0 回复  |  直到 6 年前