cl01/wp-content/plugins/nicen-localize-image/assets/load.js
2025-02-24 12:39:24 +08:00

62 lines
1.2 KiB
JavaScript
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @author 友人a丶
* @date 2022-08-12
* 弹出层
* */
/**
* 配置antd
* */
let message = antd.message;
let Modal = antd.Modal;
message.config({
top: `50px`,
duration: 3,
maxCount: 3,
});
let hide = null;
let load = {
loading(text = '加载中...') {
hide = message.loading(text, 0);
},
loaded() {
if (hide) {
hide();
}
},
success(text = '加载成功!') {
message.success(text);
},
error(text = '加载异常') {
message.error(text);
},
info(text = '加载异常') {
message.info(text);
},
confirm(text, callback = null, cancel = null) {
Modal.confirm({
title: '提示',
centered: true,
content: text,
maskClosable: false,
onOk: (close) => {
close(); //关闭
if (callback) {
callback()
}
}, onCancel: (close) => {
close(); //关闭
if (cancel) {
cancel()
}
}
})
}
}