@cainiaofe/cn-ui-m
Version:
26 lines (25 loc) • 1.03 kB
JavaScript
import * as React from 'react';
import { CnDemoBlock, CnDemoPage, CnRadioGroup } from "../../..";
export var 受控 = function () {
var _a = React.useState(2), groupValue = _a[0], setGroupValue = _a[1];
return (React.createElement(CnDemoPage, { title: "\u53D7\u63A7" },
React.createElement(CnDemoBlock, { title: "\u53D7\u63A7" },
React.createElement(CnRadioGroup, { value: groupValue, direction: "hoz", onChange: function (value) {
console.log('selected radio is:', value);
setGroupValue(value);
}, dataSource: [
{
label: '选项 1',
value: 1,
},
{
label: '选项 2',
value: 2,
},
{
label: '选项 3',
value: 3,
},
] }))));
};
export default { title: 'demo/CnRadio' };