项目
在 GitHub 查看
sweetalert2/sweetalert2-react-content
关于
SweetAlert2 官方扩展,支持将 React 元素用作内容
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文sweetalert2-react-content
Official SweetAlert2 enhancer adding support for React elements as content.
- Simple example: https://sweetalert2.github.io/recipe-gallery/sweetalert2-react.html
- With React Router: https://sweetalert2.github.io/recipe-gallery/sweetalert2-react-router.html
- With react-day-picker: https://sweetalert2.github.io/recipe-gallery/input-datepicker.html
The following options can be React elements:
titlehtmlconfirmButtonTextdenyButtonTextcancelButtonTextfootercloseButtonHtmliconHtmlloaderHtml
Installation
npm install sweetalert2 sweetalert2-react-content
Usage Example
import Swal from 'sweetalert2'
import withReactContent from 'sweetalert2-react-content'
const MySwal = withReactContent(Swal)
MySwal.fire({
title: <p>Hello World</p>,
didOpen: () => {
// `MySwal` is a subclass of `Swal` with all the same instance & static methods
MySwal.showLoading()
},
}).then(() => {
return MySwal.fire(<p>Shorthand works too</p>)
})
The dist/sweetalert2-react-content.umd.js file defines window.sweetalert2ReactContent in non-CJS/AMD environments.
探索相关项目
加载中…