#ScanInput
ScanInput は、入力欄にスキャン機能を追加するためのコンポーネントです。
#基本的な使い方
Current value: -
import React, { useState } from 'react';
import { ScanInput } from '@nocobase/client-v2';
import { Space, Typography } from 'antd';
export default function ScanInputDemo() {
const [value, setValue] = useState('');
return (
<Space direction="vertical" style={{ width: 360 }}>
<ScanInput
value={value}
placeholder="Scan or input code"
onChange={(next) => {
if (typeof next === 'string') {
setValue(next);
} else {
setValue(next.target.value);
}
}}
/>
<Typography.Text type="secondary">
Current value: {value || '-'}
</Typography.Text>
</Space>
);
}
#API
| パラメータ | 型 | 説明 |
|---|---|---|
disableManualInput | boolean | 入力欄を読み取り専用にする |
enableScan | boolean | 予約パラメータ。スキャンボタンは常に表示される |
formatsToSupport | Html5QrcodeSupportedFormats[] | 対応する QR コード / バーコード形式 |
onChange | `(value: string | ChangeEvent |

