如何从 shopify 的 img srouce 中删除 ?v=2222dddhh4?

How can I remove ?v=2222dddhh4 from img srouce in shopify?

如何从 shopify 的 img srouce 中删除 ?v=2222dddhh4?

主要来源:

我要:

<img src="https://cdn.shopify.com/s/files/1/1608/4177/files/Size_Guide.png>

使用 javascript 和 jquery 可能对您有帮助:

$('img').each(function(){
 var _src = $(this).attr('src');//get attribute src
 _src = _src.replace(/\?v=.*?$/g,'');
 $(this).attr('src',_src);//replace your same img
 $('span').append(_src);//for test
});

jsfiddle

或者您可以简单地使用: | split:'?' | first 它会把你的 link 和 '?' 分开并且将只显示第一部分,即 '?' 之前的 link。