方式1
import tsIcon from '../images/typescript.jpeg';
方式2
const tsIcon = require('../images/typescript.jpeg');
使用方式1
<img src={tsIcon} alt="" />
使用方式2
const styles = { test: { background: `url(${tsIcon}) no-repeat center` }}render() { return ( <div style={styles.test}></div> )}
下面是小案例图片