# @vizoy/sw2

> 基于sweetalert2(v14.4)封装的弹框库 https://sweetalert2.github.io/

Latest version **1.0.3** (published 2022-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vizoy/sw2
pnpm add @vizoy/sw2
yarn add @vizoy/sw2
bun add @vizoy/sw2
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-03-28 |
| First published | 2022-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 68.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | vizo |
| Maintainers | vizoy |
| Keywords | sw2, swal |

## Links

- npm: https://www.npmjs.com/package/@vizoy/sw2
- npm.io page: https://npm.io/package/@vizoy/sw2

## Recent versions

- 1.0.3 (latest) — 2022-03-28
- 1.0.2 — 2022-03-01
- 1.0.1 — 2022-03-01
- 1.0.0 — 2022-03-01

## README

# sw2

#### 介绍
基于sweetalert2(v14.4)封装的弹框库
https://sweetalert2.github.io/

#### 示例
``` js

<script src="https://unpkg.com/@vizoy/sw2@latest/sw2.js"></script>

// suc, err, inf, warn, confirm, prompt, msg

// 普通弹框
sw.suc('成功了')
sw.inf('信息', 1000)
sw.warn('警告')
sw.err('错误')

// 消息弹框, 默认2500毫秒消失
suc.msg('xx', 800)

// 确认框
sw.confirm('确定删除吗?').then(res => {
  if (res.isConfirmed) {
    console.log( '已删除' )
  }
})

// 输入框
sw.prompt('请输入xx').then(res => {
  if (res.isConfirmed) {
    console.log( res.value )
  }
})

// 自定义, 覆盖原配置
sw.confirm({
  title: '提示',
  html: '确认删除吗?',
  cancelButtonColor: '#f00',
})



```

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