我有一个小型的React Web应用程序,该应用程序可以正常运行,同时拥有五个低质量的视频。 但是,一旦我添加了多个大型高质量视频文件并启动了该应用程序,笔记本电脑就会死机,需要手动关闭它。
//outside the component class
function importAll(r){
let images = {};
r.keys().forEach((item) => { images[item.replace('./', '')] = r(item); });
return images;
}
componentDidMount() {
const videos = importAll(require.context('./videos', false, /\.mp4$/));
window.addEventListener('scroll', this.handleScroll);
}
我的视频文件夹位于我的src文件夹中,有什么建议吗?
在此先感谢任何可以提供帮助的人!