1.0.3 • Published 2 years ago

@vizoy/sw2 v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

sw2

介绍

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

示例

<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',
})
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago