zoukankan      html  css  js  c++  java
  • 常用的设计模式

    常用的设计模式
    `

            let TankFactor = {
            tankList: {
                "01": function() {
                    const img = new Image(); 
                    img.src = "./images/01.jpg";
                    return img;
                },
                "02": function() {
                    const img = new Image(); // 创建一张图片
                    img.src = "./images/02.jpg";
                    return img;
                },
                "03": function() {
                    const img = new Image(); 
                    img.src = "./images/03.jpg";
                    return img;
                },
                "04": function() {
                    const img = new Image(); 
                    img.src = "./images/04.jpg";
                    return img;
                }
            },
            create: function(type) { // 通过create来创建坦克 
                let info = this.tankList[type]();    // this.tankList['01']
                return info;
            }
        }
        let v1 = TankFactor.create('02');
        document.body.appendChild(v1);
    
    
  • 相关阅读:
    flex 弹性盒布局 移动端首页
    less+rem基础使用
    github 本地操作
    git 码云
    react基础知识
    css样式
    uni-app 知识点
    web app
    2019年一半已过,这些大前端技术你都GET了吗?- 下篇
    2019年大前端技术周刊-#31周
  • 原文地址:https://www.cnblogs.com/lyly96720/p/12526840.html
Copyright © 2011-2022 走看看