# @ahws/login

> react antd login page

Latest version **0.0.7** (published 2021-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ahws/login
pnpm add @ahws/login
yarn add @ahws/login
bun add @ahws/login
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2021-01-28 |
| First published | 2021-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 395 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | uub |
| Maintainers | uub |
| Keywords | react, login, ahws-login, antd login, react login |

## Links

- npm: https://www.npmjs.com/package/@ahws/login
- Repository: https://github.com/ybuiw/ahws
- Homepage: https://github.com/ybuiw/ahws#readme
- Issues: https://github.com/ybuiw/ahws/issues
- npm.io page: https://npm.io/package/@ahws/login

## Dependencies (1)

- [react-captcha-code](https://npm.io/package/react-captcha-code.md) ^1.0.5

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2021-01-28
- 0.0.6 — 2021-01-15
- 0.0.5 — 2021-01-14
- 0.0.4 — 2021-01-13
- 0.0.3 — 2021-01-12
- 0.0.2 — 2021-01-12
- 0.0.1 — 2021-01-12

## README

react后台登录页封装
===
基于 `antd` 后台登录页面封装。依赖 `antd`, `react-captcha-code`。
支持（账号/密码/验证码、账号/密码、手机号/验证码）三种方式。

### 安装

```bash
npm install --save @ahws/login
```

### 引入

```jsx
import Login from '@ahws/login';
```

### 基本用法

<!--DemoStart,bgWhite,codePen,codeSandbox--> 
```js
import Login from '@ahws/login';
import bg from 'bg.png';
import log from 'log.png';

const LoginPage = () => {
  const onLogin = (value: any) => {
    console.log(v)
  }

  const getCode = (callback: any) => {
    // 模拟发送验证码
    setTimeout(() => {
      // 发送成功
      callback(true)

      // 发送失败
      // callback(false)
    }, 1000);
  }

  return (
    <Login
      style={{backgroundImage: `url(${bg})`}}
      title={ <img src={log} alt="" /> }
      source="mobile"
      values={{ mobile: 18888888888 }}
      count={60}
      onCode={getCode}
      onLogin={onLogin}
    />
  )
}

export default LoginPage;
```
<!--End-->

## Props

| 参数 | 说明 | 类型 | 默认值 |
| -------- | -------- | -------- | -------- |
| title | 标题/logo | String/ReactNode | -- |
| source | 登录框类型 | `username/code` / `username` / `mobile` | `username/code` |
| count | source 为 mobile 的时候生效，设置倒计时长 | Number | 60 |
| values | 登陆默认值，只有初始化以及重置时生效 | Object | -- |
| onCode | source 为 mobile 的时候生效，获取验证码后回调 | function(boolean, msg) | -- |
| onLogin | 提交表单且数据验证成功后回调事件 | function(values) | -- |


## 效果图
![calendar](https://github.com/ybuiw/ahws/blob/master/packages/lgoin/1.png)
![calendar](https://github.com/ybuiw/ahws/blob/master/packages/lgoin/2.png)

---
_Source: https://npm.io/package/@ahws/login · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
