miniapp-web-jsapi
Version:
JSAPI/View adapter for miniprogram running on the web
26 lines • 836 B
JavaScript
import Alert from "../../components/alert";
export function alert(options) {
var _ref = options || {},
title = _ref.title,
content = _ref.content,
buttonText = _ref.buttonText,
success = _ref.success,
complete = _ref.complete;
var div = document.createElement('div');
document.body.appendChild(div);
var alert = new Alert({
target: div,
props: {
title: title,
content: content,
buttonText: buttonText,
onClose: function onClose() {
var _div$parentNode;
success === null || success === void 0 ? void 0 : success();
complete === null || complete === void 0 ? void 0 : complete();
alert.$destroy();
(_div$parentNode = div.parentNode) === null || _div$parentNode === void 0 ? void 0 : _div$parentNode.removeChild(div);
}
}
});
}