 
						更新时间:2021-01-03 23:49:41
coco-modal是一个简单实用的javascript弹框插件, 兼容主流浏览器,兼容至ie9 (ie9没有动画效果)
通过npm安装:
| 1 2 3 4 5 | 
基本用法
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <style>    body{            margin:0        }        .root {          width: 1000px;          height: 2000px;          background-color: #f1f1f2;          margin: 0 auto;           }</style><divclass="root"></div><script>    window.CocoConfig = {        buttonColor: '#e71e63'    }    let root = document.body.querySelector(".root");    let count = 0;    root.addEventListener("click", () => {        let n = count++ % 3;        n === 0 && coco("hello world");        n === 1 && coco.alert("alert");        n === 2 && coco.confirm("confirm");    });</script> | 
显示一个输入框
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | <style>    body{            margin:0        }        .root {          width: 1000px;          height: 2000px;          background-color: #f1f1f2;          margin: 0 auto;        }</style><divclass="root"></div><script>    window.CocoConfig = {        buttonColor: '#e71e63'    }    let root = document.body.querySelector(".root");    root.addEventListener("click", () => {        coco({            title: "验证输入",            inputAttrs: {                placeholder: "your name",            },        }).onClose((cc, isOk, done) => {            console.log(cc.closeType);            if (isOk) {                if (cc.inputValue.trim() === "") {                    cc.setErrorText("输入不能为空!");                } else {                    cc.setErrorText("");                    cc.inputEl.value = "";                    done();                }            } else {                done();            }        });    });</script> | 
window.CocoConfig 接收的参数作用所有的modal,单个modal的参数会覆盖全局参数
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | {    el: null, // 一个dom节点或者选择器  el: '#login'    maskClose: true,    header: true,    footer: true,    title: '提示',    text: '',    width: '500px',    top: '15vh',    inputAttrs: false,    escClose: true,    okButton: true,    cancelButton: true,    okText: '确定',    cancelText: '取消',    closeButton: true,    html: '',    zIndexOfModal: 1995,    zIndexOfMask: 2008,    zIndexOfActiveModal: 2020,    autoFocusOkButton: true,    autoFocusInput: true,    fullScreen: false,    borderRadius: '6px',    blur: false,    buttonColor: '#4285ff',    onMount() {},    hooks: {        open() {},        opened() {},        close() {},        closed() {}    },    destroy: false,    animation: true} | 
特别申明:
			本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
			本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
			如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com