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

在哪个网站上做推广作用好网站建设方案包括哪些内容

在哪个网站上做推广作用好,网站建设方案包括哪些内容,心理教育网站建设目的,wordpress 分享实现class 模拟类的方式语法糖#xff08;把以前的写法换了一个方式#xff09; 类内部的方法是不可枚举的 ES5用Object.assign拓展的原型属性是可枚举的 function Point(x, y) {this.x x;this.y y; } // 这样定义的原型上方法eat\drink是可枚举的 Point.prototype Object…class 模拟类的方式语法糖把以前的写法换了一个方式 类内部的方法是不可枚举的 ES5用Object.assign拓展的原型属性是可枚举的 function Point(x, y) {this.x x;this.y y; } // 这样定义的原型上方法eat\drink是可枚举的 Point.prototype Object.assign(Point.prototype, {eat: function () { },drink: function () { }, })ES6定义的公有属性是不可枚举的 class Point {constructor(x, y) {// 实例化的属性配置私有属性this.x x;this.y y;}// 公有属性原型上的方法toString() {return ( this.x , this.y );} } const p new Point(1, 1) console.log(p) console.log(p.toString())默认指定constructor class Point{} const p new Point() console.log(p)class Foo {constructor() {return Object.create(null);} }new Foo() instanceof Foo // false表达式写法和IIFE // 看起来很怪异 let Point class { } const p new Point() console.log(p)let person new class Person { }() console.log(person) let person new class Person {constructor(name, age) {this.name name;this.age age;} }(Lee, 10) console.log(person)存在TDZ 不可提升 ES7私有属性新写法 class可以定义公有方法不可定义公有属性 class Point {// ES7新写法依然是私有属性x 1;y 1;// 公有属性原型上的方法toString() {return ( this.x , this.y );} } console.log(new Point().toString()) // (1,1)公有属性的私有方法 Symbol const _print Symbol() console.log(_print) class Point {// ES7新写法依然是私有属性x 1;y 1;// 公有属性原型上的方法toString() {return ( this.x , this.y );}[_print]() {console.log(公有属性私有化)} } console.log(new Point().toString()) // (1,1) new Point()[_print]() // 公有属性私有化 // new Point()._print() // 这样访问不到 console.log(new Point())将方法定义到class外部 class内部不能直接使用x y class Point {x 1;y 1;print() {// 注意 这里不能直接使用x y_print.call(this, this.x, this.y);}} function _print(x, y) {console.log(this.x, this.y) } new Point().print() // 1 1 console.log(new Point())static静态方法 只能是方法不能是属性 类中定义取值、存值函数 class Point {get a() {console.log(取值函数)}set b(val) {console.log(存值函数, val)} } const p new Point() p.a // 取值函数 p.b 10 // 存值函数 10类中默认使用了严格模式 继承extends name为什么为什么不报错 super super可以指向原型对象 let proto {y: 20,z: 40 } let obj {x: 10,foo() {console.log(super.y)} } Object.setPrototypeOf(obj, proto) obj.foo() // 20转译ES5 Object.keys(Object.prototype) // []TDZuse strict不可枚举只能通过new方式调用不传参数不会报错 class Person {constructor(name Lee, age 18) {this.name name;this.age age;}say() {console.log(say)}drink() {console.log(drink)}static eat() {console.log(static eat)} }use strict; // 严格模式// 只能通过new方式调用 new方式调用下this才指向实例 function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError(Cannot call a class as a function);} }function _defineProperties(target, props) {for (var i 0; i props.length; i) {var descriptor props[i];// 原型上的属性默认是不可枚举的descriptor.enumerable descriptor.enumerable || false;descriptor.configurable true;if (value in descriptor) descriptor.writable true;Object.defineProperty(target, descriptor.key, descriptor);} }// 传入构造器 公有方法在原型上的方法静态方法只能通过类调用 function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor; }// 函数表达式 变量声明提升 TDZ var Person /*#__PURE__*/function () {function Person() {// 参数默认值var name arguments.length 0 arguments[0] ! undefined ? arguments[0] : Lee;var age arguments.length 1 arguments[1] ! undefined ? arguments[1] : 18;_classCallCheck(this, Person);this.name name;this.age age;}_createClass(Person, [{key: say,value: function say() {console.log(say);}}, {key: drink,value: function drink() {console.log(drink);}}], [{key: eat,value: function eat() {console.log(static eat);}}]);return Person; }();装饰器 npm install -D babel/plugin-proposal-decorators淘宝npm镜像pm i babel-plugin-transform-decorators-legacy --save-dev --registryhttps://registry.npm.taobao.org配置babelrc没安装前在浏览器运行代码报错Uncaught SyntaxError: Invalid or unexpected tokennpx babel app.js --watch --out-file bundle/app.js 实时监听 {presets: [babel/preset-env],plugins: [[babel/plugin-proposal-decorators, { legacy: true }]] }testable class Person {constructor(name Lee, age 18) {this.name name;this.age age;}say() {console.log(say)}drink() {console.log(drink)}} let person new Person() console.log(person, person) // person Person { name: Lee, age: 18 } function testable(target) {console.log(testable, target) // testable [Function: Person] }安装插件后打包在index.html中引入打包后的文件浏览器打印出正确结果 testable class Person {constructor(name Lee, age 18) {this.name name;this.age age;}readOnlysay() {console.log(say hi)} } let person new Person() person.say() function testable(target) {console.log(testable, target) } function readOnly(target, name, descriptor) { // target - 原型 // name - 方法名 // descriptor - 该方法的属性描述符console.log(readOnly, target, name, descriptor) }使用场景 - 埋点 在原本的功能上添加埋点功能 class AD {log(show)show() {console.log(ad is show)}log(click)click() {console.log(ad is click)} } let ad new AD() ad.show() function log(type) {return function (target, name, descriptor) {let src_fn descriptor.value; // 函数体descriptor.value (...args) {src_fn.apply(target, args);// 以下是埋点要做的console.log(埋点, type)}} }
http://www.yutouwan.com/news/393887/

相关文章:

  • 纯静态 网站神马收录提交入口
  • 一个公司网站备案吗贵阳小程序开发
  • 服装网站建设平台分析广州注册公司流程及费用
  • 企业网站前端模板电子商务网站建设 教学ppt
  • 网站建设龙兵科技燕郊网站制作多少钱
  • 中国风网站配色方案外贸网站开发莆田
  • 怎么做网站 ppt商城网站建设付款怎么实现
  • 高端网站设计价格拉丝机东莞网站建设
  • 工程建设企业网站五百亿网站建设
  • 专门做婚纱儿童摄影网站网站建设重庆
  • 网站前台界面模板下载html网页制作兼职平台
  • 常州小型网站建设wordpress数据表不可用
  • 在Vs中做网站接口企业网站建设原则是( )
  • 用iis为公司做一个内部网站企业网是什么类型
  • 电商网站建设概念温州市建设小学大南网站
  • 模板网站建设珠海网络营销课程报告
  • 青田县建设局网站广告图片网站
  • 东营有网站建筑网页设计详情
  • 手表网站建设规划书vivo应用商店
  • 做网站开发服务商阿里巴巴外贸平台下载
  • 高端旅游网站建设仿煎蛋 wordpress
  • 国家建设工程网站公司企业安全文化内容范本
  • 网站优化 情况德尔普网络做网站怎么样
  • 网站里的注册怎么做软件技术是什么专业
  • wordpress 网站图标设置音乐网站建设需求分析
  • 建个人网站的详细步骤印度做杂质的网站
  • 安卓网站开发wordpress网站商务通
  • 有哪些做网站的公司好百度爱采购
  • 营销型网站和普通网站的区别wordpress 分类翻页
  • 张家界建设局网站电话百度有专做优化的没