我有像这样的图像网址
https://lipsum.mobi/catalog/product/SE0229E/YG/AAA/4/1/SE0229E-YG-AAA-4.jpg
'并需要添加240x240
在该网址中。
当前网址:
https://lipsum.mobi/catalog/product/SE0229E/YG/AAA/4/1/SE0229E-YG-AAA-4.jpg
预期输出:https://lipsum.mobi/catalog/product/240x240/SE0229E/YG/AAA/4/1/SE0229E-YG-AAA-4.jpg
用javascript有什么简单的方法吗? 谢谢!
最佳答案
如果您的网址始终以相同的类别/前缀(例如“https://lipsum.mobi/catalog/product”)开头,或者只是具有相同数量的字符,there is a topic explaining how to do this
关于javascript - 在图片url中添加字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59925906/