import React from 'react' import Radio from './radio' import RadioGroup from './radio_group' import _ from 'lodash' import { observable } from 'mobx' import { Col, Row } from '../grid' const store = observable({ value: 3, data: [ { value: 1, text: '广州', }, { value: 2, text: '深圳', }, { value: 3, text: '成都', disabled: true, }, ], setValue(value: any) { console.log(value) this.value = value }, checked: false, setChecked(checked: any) { console.log('setChecked', checked) this.checked = checked }, }) export const ComRadio = () => (

默认

{ store.setChecked(!store.checked) }} > radio { store.setChecked(!store.checked) }} > radio

disabled

radio radio
更多同 checkbox
) export const ComRadioGroupForGrid = () => { const two = _.groupBy(store.data, (v) => Math.floor((v.value - 1) / 2)) return (
垂直布局
store.setValue(value)}> {_.map(store.data, (v) => (
{v.text}
))}
两列
store.setValue(value)}> {_.map(two, (one, oneK) => ( {_.map(one, (v) => ( {v.text} ))} ))}
) } export default { title: '表单/Radio', }