ivue-material-plus
Version:
A high quality UI components Library with Vue.js
63 lines (58 loc) • 1.62 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
require('./instance.js');
var index = require('./index2.js');
let modalInstance;
function getModalInstance(render = void 0, lockScroll = true) {
modalInstance = modalInstance || index["default"].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);
}
index["default"].info = (props = {}) => {
props.icon = "info";
props.showCancel = false;
return renderInstance(props);
};
index["default"].success = (props = {}) => {
props.icon = "success";
props.showCancel = false;
return renderInstance(props);
};
index["default"].warning = (props = {}) => {
props.icon = "warning";
props.showCancel = false;
return renderInstance(props);
};
index["default"].error = (props = {}) => {
props.icon = "error";
props.showCancel = false;
return renderInstance(props);
};
index["default"].confirm = (props = {}) => {
props.icon = "confirm";
props.showCancel = true;
return renderInstance(props);
};
index["default"].remove = () => {
if (!modalInstance) {
return false;
}
const instance = getModalInstance();
instance.remove();
};
exports["default"] = index["default"];
//# sourceMappingURL=modal.js.map