找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 查看内容

react中如何引进图片

作者:模板之家 2020-11-17 19:43 70人关注

react中引进图片的方法:1、方式一【import tsIcon from '../images/typescript.jpeg';】;2、方式二【const tsIcon = require( './images/typescrip】。

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');

使用方式一:

<img src={tsIcon} alt= "" />

使用方式二:

<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中如何引进图片的详细内容,更多请关注模板之家(www.mb5.com.cn)其它相关文章!


路过

雷人

握手

鲜花

鸡蛋
来自: 网络收集

全部回复(0)