@muyi086/verify-code
v1.0.11
Published
random some verify Codes
Downloads
6
Readme
verify-code
Install
npm install @muyi086/verify-code
# common JS
const { verifyCode } = require('@muyi086/verify-code')
# es6
import { verifyCode } from '@muyi086/verify-code'
Use
// dom create
<canvas id="canvas"></canvas>
// render verify code
const codeArr = verifyCode.random(3, 5)
// draw on the page
verifyCode.drawImg(codeArr, '#canvas')
/**
* @param {number} type 1: number;2: letter;3: number + letter
* @param {number} len verify code length
* @param {boolean} slash show slash
* @param {boolean} point show point
*/
random(type, len, slash = true, point = true)