2: 跳转页面
- location.href="页面链接"
3:页面跳转
import { Link } from 'react-router-dom'
使用
<Link to= "/app/studyMapModule/detail" >detail</Link>
报错
browser.js?fec5:49 Warning: Hash history cannot PUSH the same path;
a new entry will not be added to the history stack
原因:浏览器不会将同样的路径push到stack里
解决--添加上replace
<Link to= "/app/studyMapModule/detail" replace>detail</Link>
4:显示图片
(1)import 方法:
import logos from '../../assets/images/logos.png';//src/assets
render() {
return (
<img alt="logo" src={logos} />
)
}
(2)require方法
<img alt="logo" src={require('../../assets/images/logos.png')} />