ant-design/components/qr-code/demo/errorlevel.tsx
2024-10-21 12:03:04 +08:00

20 lines
536 B
TypeScript

import React, { useState } from 'react';
import type { QRCodeProps } from 'antd';
import { QRCode, Segmented } from 'antd';
const App: React.FC = () => {
const [level, setLevel] = useState<QRCodeProps['errorLevel']>('L');
return (
<>
<QRCode
style={{ marginBottom: 16 }}
errorLevel={level}
value="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
/>
<Segmented options={['L', 'M', 'Q', 'H']} value={level} onChange={setLevel} />
</>
);
};
export default App;