@Builder function Radio1() {Column() {Text('单选组件:')Row() {Radio({ value: '1', group: 'radioGroup' })Text('选项1')}Row() {Radio({ value: '2', group: 'radioGroup' })Text('选项2')}}.margin(10)
}@Builder function Checkbox1() {Column() {Text('多选组件:')Row() {CheckboxGroup({ group: 'checkboxGroup' })Text('全 选')}Row() {Checkbox({ name: '1', group: 'checkboxGroup' })Text('选项1')}Row() {Checkbox({ name: '2', group: 'checkboxGroup' })Text('选项2')}}.margin(10)
}let factoryMap: Map<string, object> = new Map()
factoryMap.set('Radio', wrapBuilder(Radio1))
factoryMap.set('Checkbox', wrapBuilder(Checkbox1))export { factoryMap }
import { factoryMap } from './compoents/FactoryComponent'let myRadio: WrappedBuilder<[]> = factoryMap.get('Radio') as WrappedBuilder<[]>
let myCheckbox: WrappedBuilder<[]> = factoryMap.get('Checkbox') as WrappedBuilder<[]>
@Entry
@Component
struct Index8_1 {build() {Column() {myRadio.builder()myCheckbox.builder()}}
}