react中引进图片的方法:1、方式一【import tsIcon from '../images/typescript.jpeg';】;2、方式二【const tsIcon = require( './images/typescrip】。
react中引进图片的方法:
方式一:
import tsIcon from '../images/typescript.jpeg';
方式二:
const tsIcon = require( '../images/typescript.jpeg');
使用方式一:
@@##@@
使用方式二:
<div style={{ background: `url(${tsIcon}) no-repeat`}}> </div>
使用方式三:
const styles = { test: { background: `url(${tsIcon}) no-repeat center` }}render() { return ( <div style={styles.test}></div> )}
相关免费学习推荐:JavaScript(视频)
以上就是react中如何引进图片的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号