仅供参考:
import mp4 from '../../assets/images/mp4.mp4';
<video muted src={mp4} height="458" autoPlay loop style={{ padding: '20px' }} ></video>
如果直接像上面用不行的话,webpack中再检查装载机配置。
使用url-loader。我这里是webpack-chain的形式修改webpack配置。
config.module
.rule('url')
.test(/\.mp4$/)
.use('url-loader')
.loader('url-loader')
.options({
limit: 10000,
outputPath: 'video/'
})