摘要: // es5的继承 function Animal(name,color){ this.name = name; this.color = color; } Animal.prototype.eat = function(){ console.log(this.name + ' is eating' 阅读全文
posted @ 2021-12-09 13:31 lisa2544 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 功能1.页面加载成功后,会随机的出现一定数量的div2.div的大小,color,position随机3.鼠标悬停时,div变大,并浮动到最前面 Card.js class Card{ //构造函数 /* x:横坐标 y:纵坐标 */ constructor(x,y,width,height,col 阅读全文
posted @ 2021-12-09 13:29 lisa2544 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 1.定义 // es5封装一个对象 function Person(name,age){ this.name = name; this.age = age; } Person.prototype.run = function(){ console.log(this.name+" is running 阅读全文
posted @ 2021-12-09 12:45 lisa2544 阅读(34) 评论(0) 推荐(0) 编辑
摘要: //async函数的基本语法 function getData(code){ return new Promise((resolve,reject)=>{ setTimeout(()=>{ console.log(code); },1000) }) } //async函数定义 /* async函数的 阅读全文
posted @ 2021-12-09 10:13 lisa2544 阅读(165) 评论(0) 推荐(0) 编辑
摘要: eg.先获取商品详情,在获取商品评论 // es6 Promise let pro = new Promise((resolve,reject)=>{ $.ajax({ url:'http://localhoset:3000/goos_detail', data:{id:2}, dataType:' 阅读全文
posted @ 2021-12-09 10:11 lisa2544 阅读(21) 评论(0) 推荐(0) 编辑