|
@@ -306,14 +306,36 @@
|
|
|
|
|
|
function toast(i, e) {
|
|
|
const {onClick: t, duration: r} = e || {};
|
|
|
- return window.Toastify({
|
|
|
+ // return window.Toastify({
|
|
|
+ return (new Toastify({
|
|
|
text: i,
|
|
|
duration: r || 3e3,
|
|
|
position: "center",
|
|
|
onClick: function() {
|
|
|
t && t()
|
|
|
}
|
|
|
- }).showToast()
|
|
|
+ })).showToast()
|
|
|
+ // }).showToast()
|
|
|
+ }
|
|
|
+
|
|
|
+ class Toastify {
|
|
|
+ constructor(options) {
|
|
|
+ this.text = options.text
|
|
|
+ this.duration = options.duration
|
|
|
+ this.onClick = options.onClick
|
|
|
+ }
|
|
|
+ showToast() {
|
|
|
+ setTimeout(() => {
|
|
|
+ let res = confirm(this.text)
|
|
|
+ if(res) {
|
|
|
+ this.onClick()
|
|
|
+ }
|
|
|
+ }, this.duration)
|
|
|
+ return this
|
|
|
+ }
|
|
|
+ hideToast() {
|
|
|
+ return this
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 将原json里的值全部转成float,并返回一个新json
|