10.0.0 • Published 4 years ago

ngx-gesture-password v10.0.0

Weekly downloads
28
License
MIT
Repository
github
Last release
4 years ago

ngx-gesture-password

A smart gesture password locker for angular (mobile browser)

来源于 如何用原生 JS 实现手势解锁组件,有兴趣可以深入阅读!

NPM version Ci

Demo

Online(only mobile mode)

screenshot

qr

Ionic

ionic

Usage

1. Install

npm install ngx-gesture-password --save

import GesturePasswordModule

import { GesturePasswordModule } from 'ngx-gesture-password';

@NgModule({
    imports: [ BrowserModule, GesturePasswordModule ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

2、Template

<gesture-password style="height: 350px;"
        [(ngModel)]="pwd" [type]="type" [options]="options"
        (error)="onError($event)"
        (checked)="onChecked($event)"
        (beforeRepeat)="onBeforeRepeat($event)"
        (afterRepeat)="onAfterRepeat($event)"></gesture-password>
NameTypeDefaultSummary
type'check','recorder''check'check 检查手势密码,recorder 设置手势密码
optionsOptions配置项
errorFunction(res: Result)
checkedFunction(res: Result)当 type==='check' 时每一次绘制完成后触发
beforeRepeatFunction(res: Result)当 type==='recorder' 时第一次绘制完成后触发
afterRepeatFunction(res: Result)当 type==='recorder' 时第二次绘制完成后触发

Options

NameTypeDefaultSummary
numnumber3圆点的数量
focusColorstring#e06555当前选中的圆的颜色
fgColorstring#d6dae5未选中的圆的颜色
bgColorstring#fff背景颜色
innerRadiusnumber20圆点的内半径
outerRadiusnumber50圆点的外半径,focus 的时候显示
touchRadiusnumber70判定touch事件的圆半径
renderbooleantrue自动渲染
minnumber3最小允许的点数
passwordsstring[]密码编码,数量必须是 num*num,否则会产生Error;默认值:[ '1', '2', '3', '4', '5', '6', '7', '8', '9']

Enum ERR

  • SUCCESS、null、undefined 密码属于有效值。
  • NOT_ENOUGH_POINTS 不足最少节点
  • PASSWORD_MISMATCH 密码不匹配
  • USER_CANCELED 用户主动取消

Result

NameTypeDefaultSummary
errERR错误状态,见 enum ERR
resultstring根据密码编码解析后的真实密码值
recordsArray路径数据,只有成功状态才会返回

Troubleshooting

Please follow this guidelines when reporting bugs and feature requests:

  1. Use GitHub Issues board to report bugs and feature requests (not our email address)
  2. Please always write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it.

Thanks for understanding!

License

The MIT License (see the LICENSE file for the full text)

10.0.0

4 years ago

9.0.0

4 years ago

9.0.0-rc.1

4 years ago

7.0.0

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

2.0.0-beta.1

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago