Modal.js 800 Bytes
import template from "./Modal.html";
import style from "antd/lib/modal/style/index.css";

class Modal {
    useModules = ["esNgAntd"];

    props = {
        visible: Boolean,
        title: String,
        okText: String,
        cancelText: String,
        onOk: Function,
        onCancel: Function,
        width: Number,
        footer: String
    };

    state = {
        width: this.props.width || 416,
        okText: this.props.okText || "确定",
        cancelText: this.props.cancelText || "取消",
    };

    template = template;

    handleClose() {
        if (typeof this.props.onCancel === "function") {
            this.props.onCancel();
        }
    }

    constructor() {
        $element[0].removeAttribute("title");
        esNgAntd.createStyle("ant-modal", style);
    }
}