Skip to main content

react引入图片

方式一:先导入再使用

import logo from './images/logo.png'

const Example = () => {
return <img src={logo} alt="" />
}

方式二:直接请求使用

const Example = () => {
return <img src={<img src={require('./images/logo.png')} alt="" />} alt="" />
}