我有一个导入图像文件的功能,我想将缩略图与原始文件关联起来。我需要_og在第一次出现句点之前插入。有人可以帮助我使用正则表达式或知道不同的方式吗?
importAll(r) {
let imageArray = r.keys();
// This removes the actual original file from the array
// so it only includes the thumbnails since they are all in the same directory.
imageArray = imageArray.filter(s => !s.includes('_og'));
imageArray.forEach(key => (
this.images.push({
path: r(key), // thumbnail
pathOriginal: r(key).replace(/./g , "_og."), // original
})
));
}
慕勒3428872
相关分类