![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
javascript设计模式
LeuPener
这个作者很懒,什么都没留下…
展开
-
单列模式
class LoginForm { constructor() { this.state = 'hide' } show() { if(this.state === 'show'){ alert('已经显示') return } this.state = 'sho...原创 2019-11-08 18:24:32 · 82 阅读 · 0 评论 -
SOLID五大设计原则
s-单一职责原则 o-开放封闭原则 l-李氏置换原则 i-接口独立原则 d-依赖导致原则 promise function loadImg(src) { let promise = new Promise(function(resolve, reject) { let img = document.createElement('img') img.onloa...原创 2019-11-05 18:37:25 · 126 阅读 · 0 评论 -
设计原则实例1
//父类 车辆 class Car{ constructor(number, name){ this.name = name; this.number = number; } } //快车 class Kuaiche extends Car{ constructor(number, name, pice){ super(nu...原创 2019-10-29 23:00:33 · 221 阅读 · 0 评论 -
面向对象
什么是面向对象 //父类 class person{ constructor(name, age){ this.name = name; this.age = age } eat() { console.log(`${this.name} eat somethings`); } speak() { ...原创 2019-10-28 22:11:44 · 73 阅读 · 0 评论 -
环境搭建
npm init npm install webpack webpack-cli --save-dev --registry=https://registry.npm.taobao.org npm run dev npm install webpack-dev-server html-webpack-plugin --save-dev --registry=https://registry.np...原创 2019-10-27 21:47:16 · 84 阅读 · 0 评论