justmywyw's picture
Upload folder using huggingface_hub
630cbf4 verified
raw
history blame
739 Bytes
(props, cc, { el, onMount }) => {
const options = JSON.parse(props.options);
el.innerHTML = `
${options
.map((option) => {
return `<div>
<label>${option} <input type="radio"/></label>
<div>`;
})
.join('')}
`;
onMount(() => {
const inputs = Array.from(el.getElementsByTagName('input'));
Array.from(el.getElementsByTagName('label')).forEach((label, i) => {
label.addEventListener('click', () => {
inputs.forEach((input) => {
input.checked = false;
});
const input = label.getElementsByTagName('input')[0];
input.checked = true;
// ι€šθΏ‡ cc.dispatch 向 python δΎ§ε‘ι€ι€šηŸ₯
cc.dispatch(options[i]);
});
});
});
};