Javascript React路由器(v3)未加载映像
您好,我正在使用Javascript React路由器(v3)未加载映像,javascript,reactjs,react-router,Javascript,Reactjs,React Router,您好,我正在使用react路由器浏览我的网页 我使用create react app启动我的项目 使用React@15.4.2,反应-router@3.0.2 一件奇怪的事情正在发生;手动刷新时加载图像,但使用导航栏导航到web的不同部分时无法加载图像 我是这样定义路线的: Class App extends Component{ render () { return ( <Router history={browserHistory}>
react路由器
浏览我的网页
我使用create react app
启动我的项目
使用React@15.4.2,反应-router@3.0.2
一件奇怪的事情正在发生;手动刷新时加载图像,但使用导航栏导航到web的不同部分时无法加载图像
我是这样定义路线的:
Class App extends Component{
render () {
return (
<Router history={browserHistory}>
<Route path="/" component={Main}>
<IndexRoute component={Home}/>
<Route path="create" component={Create}/>
<Route path="login" component={Login}/>
</Route>
</Router>
);
}}
但同样的事情发生了
{Main}
组件中的图像执行相同的操作
我是否加载了错误的图像??如果是这样,当我手动刷新页面时,它是如何加载的?
还是我走错路线了
*尝试使用绝对路径从web()加载随机图像。
同样的事情还在发生
import React, { Component } from 'react';
class Login extends Component{
render () {
return (
<div>
<div className="main-container">
<section className="height-100 imagebg text-center" data-overlay="4">
<div className="background-image-holder">
<img alt="background" src='img/inner-6.jpg' />
</div>
<div className="container pos-vertical-center">
<div className="row">
<div className="col-sm-7 col-md-5">
<h2>Login to continue</h2>
<p className="lead">
Welcome back, sign in with your existing Stack account credentials
</p>
<form>
<div className="row">
<div className="col-sm-12">
<input type="text" placeholder="Username" />
</div>
<div className="col-sm-12">
<input type="password" placeholder="Password" />
</div>
<div className="col-sm-12">
<button className="btn btn--primary type--uppercase" type="submit">Login</button>
</div>
</div>
</form>
<span className="type--fine-print block">Dont have an account yet?
<a href="page-accounts-create-1.html">Create account</a>
</span>
<span className="type--fine-print block">Forgot your username or password?
<a href="page-accounts-recover.html">Recover account</a>
</span>
</div>
</div>
</div>
</section>
</div>
</div>
);}}
export default Login;
src={require('./img/inner-6.jpg')}