Package Exports
- pin-code-react
- pin-code-react/dist/index.umd.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pin-code-react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
安装
npm install pin-code-react --save
使用
import React, { useState, useCallback, ChangeEvent } from 'react';
import PinCode from 'pin-code-react';
import 'pin-code-react/dist/index.css';
export default function Add () {
const [content, setContent] = useState('');
const [value, setValue] = useState('');
const getCode = useCallback((value: string) => {
setContent(value);
}, [])
const onChange = (e: ChangeEvent<HTMLInputElement>) => {
setValue(e.target.value);
}
return (
<div>
<PinCode type="text" isImmediate sureContent={<button>确定</button>} onFinished={getCode} />
<input type="text" onChange={onChange} value={value} />
<div>{content}</div>
</div>
)
}