文档部分内容更新

This commit is contained in:
xiejie 2022-01-21 13:34:01 +08:00
parent eed8577142
commit a23ef9c13e

View File

@ -58,7 +58,7 @@ class Computer {
上面的代码非常的简单,我们定义了一个名为 Computer 的类,该类存在 *name、price* 这两个实例属性,一个 *showSth* 的原型方法以及一个 *comStruct* 的静态方法。 上面的代码非常的简单,我们定义了一个名为 *Computer* 的类,该类存在 *name、price* 这两个实例属性,一个 *showSth* 的原型方法以及一个 *comStruct* 的静态方法。
@ -519,51 +519,51 @@ e.init();
> "use strict"; > "use strict";
> >
> function _classCallCheck(instance, Constructor) { > function _classCallCheck(instance, Constructor) {
> if (!(instance instanceof Constructor)) { > if (!(instance instanceof Constructor)) {
> throw new TypeError("Cannot call a class as a function"); > throw new TypeError("Cannot call a class as a function");
> } > }
> } > }
> >
> function _defineProperties(target, props) { > function _defineProperties(target, props) {
> for (var i = 0; i < props.length; i++) { > for (var i = 0; i < props.length; i++) {
> var descriptor = props[i]; > var descriptor = props[i];
> descriptor.enumerable = descriptor.enumerable || false; > descriptor.enumerable = descriptor.enumerable || false;
> descriptor.configurable = true; > descriptor.configurable = true;
> if ("value" in descriptor) > if ("value" in descriptor)
> descriptor.writable = true; > descriptor.writable = true;
> Object.defineProperty(target, descriptor.key, descriptor); > Object.defineProperty(target, descriptor.key, descriptor);
> } > }
> } > }
> >
> function _createClass(Constructor, protoProps, staticProps) { > function _createClass(Constructor, protoProps, staticProps) {
> if (protoProps) > if (protoProps)
> _defineProperties(Constructor.prototype, protoProps); > _defineProperties(Constructor.prototype, protoProps);
> if (staticProps) > if (staticProps)
> _defineProperties(Constructor, staticProps); > _defineProperties(Constructor, staticProps);
> return Constructor; > return Constructor;
> } > }
> >
> var Example = /*#__PURE__*/function () { > var Example = /*#__PURE__*/function () {
> function Example(name) { > function Example(name) {
> _classCallCheck(this, Example); > _classCallCheck(this, Example);
> >
> this.name = name; > this.name = name;
> } > }
> >
> _createClass(Example, [{ > _createClass(Example, [{
> key: "init", > key: "init",
> value: function init() { > value: function init() {
> var _this = this; > var _this = this;
> >
> var fun = function fun() { > var fun = function fun() {
> console.log(_this.name); > console.log(_this.name);
> }; > };
> >
> fun(); > fun();
> } > }
> }]); > }]);
> >
> return Example; > return Example;
> }(); > }();
> >
> var e = new Example('Hello'); > var e = new Example('Hello');