当前位置: 首页 > news >正文

哪些网站的登陆界面做的好看门户网站开发注意哪些

哪些网站的登陆界面做的好看,门户网站开发注意哪些,个人网站的主题,公司注册资金实缴政策1.原型链继承 实现原理#xff1a;子类的原型指向父类实例。子类在自身实例上找不到属性和方法时去它父类实例#xff08;父类实例和实例的原型对象#xff09;上查找#xff0c;从而实现对父类属性和方法的继承 缺点#xff1a; 子类创建时不能传参#xff08;即没有…1.原型链继承 实现原理子类的原型指向父类实例。子类在自身实例上找不到属性和方法时去它父类实例父类实例和实例的原型对象上查找从而实现对父类属性和方法的继承 缺点 子类创建时不能传参即没有实现super()的功能父类实例的修改会影响子类所有实例 function Parent(name){this.name 父级的name;}Parent.prototype.getName function(){console.log(getName:this.name);}function Child(){}// 子类原型指向父类的实例Child.prototype new Parent();Child.prototype.constructor Child;//这句话和原型链继承没有关系只是根据原型链规则绑定constructor// 测试var child new Child();console.log(child.name);//父级的namechild.getName();//getName:父级的name// 缺点不能传参父类实例改变子类所有实例也改变 2.构造函数继承 实现原理子类构造函数中执行父类的构造函数并且为父类构造函数绑定子类的this父类的构造函数把成员属性和方法都挂到子类的this上去这样既能避免实例之间共享一个原型实例又能向父类构造方法传参 缺点无法继承父类原型上的属性和方法 // 构造函数继承function Parent(name) {this.name name;console.log(父类构造函数);}Parent.prototype.getName function () {console.log(getName: this.name);}function Child(name){Parent.call(this, name);}var child new Child(张三);console.log(child);//Child {name: 张三}// 不能继承父类原型上的方法和属性child.getName();//报错child.getName is not a function 3.组合式继承 实现原理原型链继承构造函数继承 缺点父类构造函数会执行两次Parent.call()和new Parent()这不影响子类对父类的继承但是每次创建子类实例时原型中都会有两份相同的属性和方法 // 组合式继承原型链继承构造函数继承function Parent(name) {this.name name;console.log(父类构造函数);}Parent.prototype.getName function () {console.log(getName: name);}function Child(name) {Parent.call(this, this.name);}Child.prototype new Parent();Child.prototype.constructor Child;var child new Child(张三);console.log(child);//Child {name: 张三}child.getName(); 4.寄生式组合继承 实现原理父类构造函数会执行两次Parent.call()和new Parent()那么在原型链继承时就只继承父类的原型就不会执行两次父类构造函数  Child.prototype  Parent.prototype; 缺点操作子类原型对象会影响到父类原型对象例如给Child.prototype增加一个getName()方法那么会导致Parent.prototype也增加或被覆盖一个getName()方法 // 寄生式组合继承原型链继承只继承父类原型构造函数继承function Parent(name) {this.name name;}Parent.prototype.getName function () {console.log(getName: this.name);}function Child(name) {Parent.call(this, name);}Child.prototype Parent.prototype;Child.prototype.constructor Child;var child new Child(张三);console.log(child);//Child {name: 张三}child.getName(); 4.1解决寄生式组合继承的缺点使用Object.create()进行继承  如下对Child.prototype.getName子类中原型上属性或方法进行修改时父类也被修改 function Parent(name) {this.name name;console.log(父类构造函数);}Parent.prototype.getName function () {console.log(父类getName);}function Child(name) {Parent.call(this, name);}Child.prototype Parent.prototype;Child.prototype.constructor Child;Child.prototype.getName function(){console.log(子类getName);}var child new Child(张三);console.log(child);//Child {name: 张三}child.getName();var parent new Parent(李四);parent.getName(); 解决加上Object.create()方法即可 // Child.prototype Parent.prototype;Child.prototype Object.create(Parent.prototype); 5.ES6的Class继承 实现原理ES6新增是ES5中构造函数原型链继承组合继承寄生组合式继承的结合 缺点兼容性不好 6.扩展——对象的几种创建方式 字面量创建var obj new Object()创建构造函数创建Object.create()创建 // 字面量创建let obj1 {name: lmf1,say() {console.log(lmf1 say);}}// new Object()创建let obj2 new Object({name: lmf2,say() {console.log(lmf2 say);}});// 构造函数创建function Person(name) {this.name name;}let obj3 new Person(lmf3);Person.say function () {console.log(静态方法);}Person.prototype.say function () {console.log(lmf3 say);}// Object.create()创建let obj4 Object.create(obj3);console.log(obj1, obj2, obj3, obj4);
http://www.hkea.cn/news/14547777/

相关文章:

  • 网站设计的意义开发网站如何赚钱
  • 医院网站建设官网爱站网seo工具
  • iis打开网站变成下载如何建设一个视频网站
  • 找个人给我做电影网站个人怎么做微信公众号和微网站
  • cpanel 子网站微信公众平台人工电话
  • 成都网站建设金网科技西安网站漏洞
  • 阳光梦网站建设做网站笔记本2014
  • 潍柴新建站登录网址合肥建设银行网站首页
  • 怎么自己做网站空间济南公积金网站
  • 做初中试卷的网站wordpress文章添加媒体缩略图
  • 网站做子页跳转到首页外贸网站发外链
  • 西安便宜做网站深圳施工图制作
  • 如何做网站免费搭桥链接网站开发人员工作内容
  • 珠三角网站建设怎么制作网页调查问卷
  • 响应式网站做mipp2p网站开发的流程图
  • 聊城做网站费用价格互联网保险的定义与特点
  • seo精华网站做外贸网站价格
  • 石家庄网站怎么建设大型网站建设地址
  • 手工做衣服网站个人主页源码下载
  • 长沙优质营销网站建设设计google搜索引擎入口 镜像
  • 做网站公司常熟html5做的网站有哪些
  • 南山网站公司定wordpress 商业版权
  • 网站服务器租用和自己搭建的区别深圳在线招聘最新消息
  • 最简单的电子商务网站建设代码正规的郑州网站建设
  • 网站建设 安庆vue2.0网站开发
  • 烟台网站制作企业手机端网站制作教程
  • 织梦网站首页内容佛山做网站公司有哪些
  • 淮南电商网站建设360搜索引擎优化
  • 什么是网站什么是网页福州seo经理招聘
  • 做网站都需要什么一家专门做印刷的网站