ivue-material-plus
Version:
A high quality UI components Library with Vue.js
58 lines (56 loc) • 1.46 kB
JavaScript
import './instance.mjs';
import Modal from './index2.mjs';
export { default } from './index2.mjs';
let modalInstance;
function getModalInstance(render = void 0, lockScroll = true) {
modalInstance = modalInstance || Modal.newInstance({
closable: false,
maskClosable: false,
footerHide: true,
render,
lockScroll
});
return modalInstance;
}
function renderInstance(options) {
const render = "render" in options ? options.render : void 0;
const lockScroll = "lockScroll" in options ? options.lockScroll : true;
const instance = getModalInstance(render, lockScroll);
options.onRemove = function() {
modalInstance = null;
};
instance.show(options);
}
Modal.info = (props = {}) => {
props.icon = "info";
props.showCancel = false;
return renderInstance(props);
};
Modal.success = (props = {}) => {
props.icon = "success";
props.showCancel = false;
return renderInstance(props);
};
Modal.warning = (props = {}) => {
props.icon = "warning";
props.showCancel = false;
return renderInstance(props);
};
Modal.error = (props = {}) => {
props.icon = "error";
props.showCancel = false;
return renderInstance(props);
};
Modal.confirm = (props = {}) => {
props.icon = "confirm";
props.showCancel = true;
return renderInstance(props);
};
Modal.remove = () => {
if (!modalInstance) {
return false;
}
const instance = getModalInstance();
instance.remove();
};
//# sourceMappingURL=modal.mjs.map