${function(){
const optionName = option.name || '';
const optionId = option.id || '';
let isThumbImage = !!option.showThumbImage;
const thumbStyle = null;
const variantType = null;
const isSelected = (value) => {
const selected = (data.selectedOptions || []).find(v => v.name === optionName);
return selected && selected.value.length && selected.value[0] == value;
};
const getThumbImage = (value) => {
const options = data.product.options || [];
const option = options.find(o => o.name === optionName);
if (option.thumbImages) {
const thumbImage = option.thumbImages.find(t => t.value === value);
if (thumbImage && thumbImage.image) {
return {
src: thumbImage.image.src,
alt: thumbImage.image.alt
};
}
}
return {src: '', alt: ''};
};
if (variantType=='button' || isThumbImage) {
function getRadioInput(value, idx){
if (isSelected(value)) {
return `
`
} else {
return `
`
}
}
return `
`
} else {
function getOptions(){
return option.values.map(value=>{
if (isSelected(value)) {
return `
`
} else {
return `
`
}
}).join('');
}
return `
`
}
}()}