2022年3月1日
摘要:
div { color: red; font-size: 12px; } div { color: pink; } <div>长江后浪推前浪,前浪死在沙滩上</div>
阅读全文
posted @ 2022-03-01 22:36
weakup
阅读(17)
推荐(0)
2022年2月1日
摘要:
function load(src,resolve,reject){ let image=new Image(); image.src=src; image.onload=resolve; image.onerror=reject; } load( "../images/1.jpg", ()=>{
阅读全文
posted @ 2022-02-01 15:57
weakup
阅读(113)
推荐(0)
摘要:
let module=(function(){ const moduleList={}; function define(name,modules,action){ modules.map((m,i)=>{ modules[i]=moduleList[m]; }) moduleList[name]=
阅读全文
posted @ 2022-02-01 11:32
weakup
阅读(29)
推荐(0)
摘要:
function User(){} function Admin(){} Admin.prototype=Object.create(User.prototype); let hd=new Admin(); console.log(hd instanceof Admin); console.log(
阅读全文
posted @ 2022-02-01 09:53
weakup
阅读(34)
推荐(0)
2022年1月30日
摘要:
原生JS(es5)中的静态方法 //原生JS中的静态方法 function Person(name, age) { this.name = name; this.age = age; this.run = function () { console.log(`${this.name} is ${th
阅读全文
posted @ 2022-01-30 13:33
weakup
阅读(45)
推荐(0)
摘要:
class User{ // 属性 sitr='hdsj'; constructor(name){ this.name=name; } getName(){ return this.name; } changeSite(value){ this.site=value; } show(){ retur
阅读全文
posted @ 2022-01-30 11:27
weakup
阅读(78)
推荐(0)
2022年1月29日
摘要:
//使用原型工厂封装继承 function extend(sub,sup){ sub.prototype=Object.create(sup.prototype); Object.defineProperty(sub.prototype,"constructor",{ value:sub, enum
阅读全文
posted @ 2022-01-29 20:00
weakup
阅读(29)
推荐(0)
摘要:
//使用原型工厂封装继承 function extend(sub,sup){ sub.prototype=Object.create(sup.prototype); Object.defineProperty(sub.prototype,"constructor",{ value:sub, enum
阅读全文
posted @ 2022-01-29 19:54
weakup
阅读(21)
推荐(0)
摘要:
function User(name,age){ this.name=name; this.age=age; } User.prototype.show=function(){ console.log(this.name,this.age); } function Admin(...args){ /
阅读全文
posted @ 2022-01-29 19:46
weakup
阅读(74)
推荐(0)
摘要:
function Admin(){ Admin.prototype.showAdmin=function(){ return "admin"; } } function Enterprise(){ Enterprise.prototype.showEnterprise=function(){ ret
阅读全文
posted @ 2022-01-29 19:36
weakup
阅读(10)
推荐(0)