(props, cc, { el, onMount }) => { const options = JSON.parse(props.options); el.innerHTML = ` ${options .map((option) => { return `
`; }) .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]); }); }); }); };