0👍
The problem with this code is that the URL of the image you’re intending to set ([some image link]) is not being used.
Indeed, you’re checking if BrandImageSrc (the current image URL) is non-null, then you’re setting the image URL to [some image link] regardless of the imageurl passed to changeBrandImage.
If you intend to replace the product image with a new image when a chip is clicked, you’ll need to make use of imageurl, which is being passed to changeBrandImage as a parameter. Here is how you might do it:
changeBrandImage(productCode, imageurl) {
var BrandImageId = productCode + "-imgProductImage";
var BrandImage = $('#' + BrandImageId);
if (BrandImage != null) {
BrandImage.attr('src', imageurl);
}
}
In this code, imageurl, which is passed as an argument, is used to change the brand image URL.
- [Vuejs]-Vue3 Plugin giving error 'does not provide an export named 'default'' – how do I export it?
- [Vuejs]-Remove the slash (/) at the end of my routee
Source:stackexchange.com