{"id":914,"date":"2022-03-10T21:28:25","date_gmt":"2022-03-10T13:28:25","guid":{"rendered":"http:\/\/www.henrycome.com\/wordpress\/?p=914"},"modified":"2022-03-10T21:28:25","modified_gmt":"2022-03-10T13:28:25","slug":"20220310212813","status":"publish","type":"post","link":"http:\/\/www.henrycome.com\/wordpress\/202203102128\/914","title":{"rendered":"P74-78-\u9762\u5411\u5bf9\u8c61.js"},"content":{"rendered":"<pre><code class=\"language-javascript\">\/*P74-\u9762\u5411\u5bf9\u8c61-\u5b9a\u4e49class\n\/\/\u5176\u4ed6\u9762\u5411\u5bf9\u8c61\u8bed\u8a00\u7684\u6838\u5fc3\u7ed3\u6784-class\uff08\u7c7b\uff09\n\/\/\u4e0eJS\u7684\u539f\u578b\u7c7b\u4f3c\uff0c\uff08\u662f\u56fe\u7eb8-\u5de5\u5382\u751f\u4ea7\u4ea7\u54c1\u7684\u56fe\u7eb8\uff09\uff0c\u9020\u51fa\u6765\u7684\u4ea7\u54c1\u5c31\u662f\u5bf9\u8c61\u5b9e\u4f8b\uff01\n\/\/JS\u662f\u5728ES6\u89c4\u8303\u4e2d\u624d\u6709\u4e86\u9762\u5411\u5bf9\u8c61\u7684\u8bed\u6cd5\uff0c\u53ea\u4e0d\u8fc7\u5b83\u662fprototype\u539f\u578b\u7684\u4e00\u79cd\u8bed\u6cd5\u7cd6\n\/\/\u5c31\u662f\u8bf4\u5185\u90e8\u8fd8\u662f\u4f1a\u8f6c\u5316\u6210object\u548cprototype\u8fd9\u79cd\u5f62\u5f0f\u7684\n\/\/\u5b83\u7684\u9762\u5411\u5bf9\u8c61\u7684\u8bed\u6cd5\uff0c\u53ea\u662f\u65b9\u4fbf\u5927\u5bb6\u7f16\u5199\u9762\u5411\u5bf9\u8c61\u7684\u4ee3\u7801\n\n\/\/\u5982\u4f55\u5b9a\u4e49class,\n\/\/class \u7c7b\u540d\u5b57 {\u4ee3\u7801}\n\/\/1.\u5b9a\u4e49\u6784\u9020\u65b9\u6cd5\uff0c\u4f7f\u7528constructor\u5173\u952e\u5b57\uff08\u8001\u5e08\u8bf4\u4f9d\u636e\u4e2a\u4eba\u4e60\u60ef\u6784\u9020\u51fd\u6570\u4e5f\u662f\u53ef\u4ee5\u7684\uff09\n\/\/constructior()\u53ef\u4ee5\u5e26\u53c2\u6570\u6216\u4e0d\u5e26\u53c2\u6570,\n\/\/{}\u91cc\u9762\u4ee3\u7801\u548c\u666e\u901a\u6784\u9020\u51fd\u6570\u5199\u6cd5\u662f\u4e00\u6837\u7684,\u53ef\u4ee5\u5b9a\u4e49Employee\u7c7b\u4e2d\u7684\u6210\u5458\u5c5e\u6027\nclass Employee {\n    constructor(name,position){\n        this.name = name;\n        this.position = position;\n    }\n}\n\n\/\/\u521d\u59cb\u5316\u4e00\u4e2a\u5bf9\u8c61\u5b9e\u4f8b\uff0c\u548cjs\u539f\u751f\u7684\u4e00\u6837\n\/\/\u4f7f\u7528new\u5173\u952e\u5b57+\u7c7b\u540d\uff0c\u4ee3\u8868\u8c03\u7528\u8fd9\u4e2a\u7c7b\u7684\u6784\u9020\u65b9\u6cd5\uff0c\u7136\u540e\u628a\u53c2\u6570\u4f20\u8fdb\u53bb\n\/\/\u4e0e\u4f7f\u7528\u51fd\u6570\u4f5c\u4e3a\u6784\u9020\u51fd\u6570new\u521b\u9020\u7684\u5bf9\u8c61\u662f\u4e00\u6837\u7684\n\/\/log(emp)\u7684\u7ed3\u679c\uff0c\u662fEmployee\u5bf9\u8c61\uff0c\u5176\u4e2d\u67092\u4e2a\u5c5e\u6027\uff0c\u4e5f\u6709proto\uff0cconstructor\u662fclass\u7684Employee\uff0c\u518d\u4e0a\u5c42\u8fd8\u662fObject\nvar emp = new Employee(&#039;\u5cf0\u534e&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nconsole.log(emp);\/\/Employee\u00a0{name: &quot;\u5cf0\u534e&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;}\n\/\/output\n\/\/ Employee {name: &quot;\u5cf0\u534e&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;}\n\/\/     name: &quot;\u5cf0\u534e&quot;\n\/\/     position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/     __proto__:\n\/\/         constructor: class Employee\n\/\/         __proto__: Object\n\/\/end\n\/** *\/\n\n\/*P75-\u9762\u5411\u5bf9\u8c61-\u6210\u5458\u65b9\u6cd5\n\/\/\u5728\u7c7b\u91cc\u9762\u5b9a\u4e49\u65b9\u6cd5\u4e5f\u5f88\u7b80\u5355\uff0c\u76f4\u63a5\u5199\u51fd\u6570\u540d\uff0c\u65e0\u9700function\u5173\u952e\u5b57\n\/\/\u5269\u4e0b\u7684\u548c\u5b9a\u4e49\u666e\u901a\u51fd\u6570\u4e00\u6837\uff0c\u53e6\u5916\u5b83\u4e5f\u53ef\u4ee5\u7528this\u5f15\u7528\u81ea\u8eab\u7684\u5c5e\u6027\n\/\/VH:\u6784\u9020\u51fd\u6570\u5b9a\u4e49\u65b9\u6cd5\u8bed\u6cd5this.signIn=function(){},\u8fd9\u6837\u7684\u65b9\u5f0f\u3002\u572866\u8282\u539f\u578b\u6709\u4f8b\u5b50\uff0c\u4f46\u5728\u6784\u9020\u51fd\u657063\u8282\u53ea\u6709\u5b9a\u4e49\u5c5e\u6027\u7684\u4f8b\u5b50\u3002\nclass Employee {\n    constructor(name,position){\n        this.name = name;\n        this.position = position;\n    }\n\n    signIn(){\n        console.log(this.name+&#039;\u6253\u5361\u4e0a\u73ed&#039;);\n    }\n\n    get info(){\/\/get info(info)\u4f1a\u63d0\u793aUncaught SyntaxError: Getter must not have any formal parameters.\n        return this.name+&#039; &#039;+this.position;\n    }\n\n    set info(info){\n        let [name,position] = info.split(&#039; &#039;);\n        this.name = name;\n        this.position = position;\n    }\n}\nvar emp = new Employee(&#039;\u5cf0\u534e&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nconsole.log(emp);\/\/Employee\u00a0{name: &quot;\u5cf0\u534e&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;}\n\n\/\/\u8c03\u7528\u65b9\u6cd5\u548c\u5c5e\u6027\nemp.signIn();\/\/\u5cf0\u534e\u6253\u5361\u4e0a\u73ed\nconsole.log(emp.position);\/\/\u524d\u7aef\u5de5\u7a0b\u5e08\n\n\/\/\u5b9a\u4e49getter\u548csetters\n\/\/\u8bed\u6cd5\u4e0e\u539f\u751f\u4e00\u6837\uff0c\u4f7f\u7528get\u548cset\u5173\u952e\u5b57\uff0c\u540e\u9762\u8ddf\u4ee3\u8868\u5c5e\u6027\u540d\u7684\u51fd\u6570\nconsole.log(emp.info);\/\/\u5cf0\u534e \u524d\u7aef\u5de5\u7a0b\u5e08\nemp.info = &#039;\u674e\u56db \u540e\u7aef&#039;;\nconsole.log(emp.info);\/\/\u674e\u56db \u540e\u7aef\nconsole.log(emp.name, emp.position);\/\/\u674e\u56db \u540e\u7aef\n\/** *\/\n\n\/*P76-\u9762\u5411\u5bf9\u8c61-\u5b9e\u73b0\u7ee7\u627f*\/\n\/*\u4f7f\u7528extends\u5173\u952e\u5b57\n\/\/VH\uff1a\u590d\u5236\u4e0a\u8282\u7684\u5fc5\u8981\u4ee3\u7801\nclass Employee {\n    constructor(name,position){\n        this.name = name;\n        this.position = position;\n    }\n\n    signIn(){\n        console.log(this.name+&#039;\u6253\u5361\u4e0a\u73ed&#039;);\n    }\n}\n\/\/\u5b9e\u73b0\u9762\u5411\u5bf9\u8c61\u91cc\u9762\u7684\u7ee7\u627f\uff0c\u4f7f\u7528extends\u5173\u952e\u5b57\n\/\/VH\uff1a\u5b9e\u9645\u5c31\u662f\u7c7b\u548c\u7c7b\u4e4b\u95f4\u7684\u7ee7\u627f\uff0cJs\u6784\u9020\u51fd\u6570\u4e4b\u95f4\u80fd\u7ee7\u627f\u4e48\uff1f\u8fd8\u662f\u8bf4\u53ea\u80fd\u5bf9\u8c61\u4e4b\u95f4\u7ee7\u627f\u3002\u8bb0\u5f97\u662f:\u5bf9\u8c61&lt;-\u5bf9\u8c61&lt;-\u6784\u9020\u51fd\u6570&lt;-\u539f\u578b\u51fd\u6570&lt;-null\n\/\/\u4e0b\u9762\u4f8b\u5b50\u5b9a\u4e49\u65b0\u7684\u7c7bmanager\u7ee7\u627f\u81eaEmployee\u7c7b\uff0cmanager\u53eb\u5b50\u7c7b\uff0cEmployee\u53eb\u7236\u7c7b\uff0c\n\/\/\u4e00\u4e2a\u5b50\u7c7b\u53ea\u80fd\u7ee7\u627f\u4e00\u4e2a\u7236\u7c7b,\u7236\u7c7b\u7684\u6240\u6709\u5c5e\u6027\u5b50\u7c7b\u4e2d\u90fd\u53ef\u4ee5\u4f7f\u7528\nclass Manager extends Employee{};\/\/\u8001\u5e08\u8fd9\u91cc\u6ca1\u52a0\u5206\u53f7;\u4e4b\u524d\u5b9a\u4e49\u51fd\u6570\u7684\u65f6\u5019\u597d\u50cf\u90fd\u6ca1\u6709\u52a0\n\/\/\u521b\u5efa\u5b9e\u4f8b\nvar manager = new Manager(&#039;\u738b\u4e94&#039;, &#039;\u7ecf\u7406&#039;);\nconsole.log(manager);\/\/Manager\u00a0{name: &quot;\u738b\u4e94&quot;, position: &quot;\u7ecf\u7406&quot;}\n\/\/\u8c03\u7528\u65b9\u6cd5\nmanager.signIn();\/\/\u738b\u4e94\u6253\u5361\u4e0a\u73ed\n\n\/\/\u589e\u52a0\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u53ef\u7528\u539f\u751f\u65b9\u5f0f\uff0c\u4e0d\u7b26\u5408\u9762\u5411\u5bf9\u8c61\u7684\u89c4\u8303\nmanager.dept = &#039;\u6280\u672f\u90e8&#039;;\nconsole.log(manager);\/\/Manager\u00a0{name: &quot;\u738b\u4e94&quot;, position: &quot;\u7ecf\u7406&quot;, dept: &quot;\u6280\u672f\u90e8&quot;}\n\/** *\/\n\n\/*\u9762\u5411\u5bf9\u8c61\u7684\u589e\u52a0\u5c5e\u6027\u7684\u65b9\u6cd5\n\/\/VH\uff1a\u590d\u5236\u4e0a\u8282\u7684\u5fc5\u8981\u4ee3\u7801\nclass Employee {\n    constructor(name,position){\n        this.name = name;\n        this.position = position;\n    }\n\n    signIn(){\n        console.log(this.name+&#039;\u6253\u5361\u4e0a\u73ed&#039;);\n    }\n}\n\/\/\u901a\u8fc7\u8c03\u7528\u7236\u7c7b\u7684\u6784\u9020\u51fd\u6570\u6765\u6269\u5c55manager\u81ea\u8eab\u7684\u5c5e\u6027\n\/\/\u4f7f\u7528super\u5173\u952e\u5b57\u6765\u4ee3\u8868\u7236\u7c7b\u81ea\u8eab\n\/\/manager\u7c7b\u4e2d\u5b9a\u4e49\u81ea\u5df1\u7684\u6784\u9020\u51fd\u6570\nclass Manager extends Employee{\n    constructor(name,position,dept){\/\/constructor\u5b9a\u4e49Manager\u81ea\u5df1\u7684\u6784\u9020\u51fd\u6570\n        super(name,position);\/\/\u8c03\u7528\u7236\u7c7b\u7684\u6784\u9020\u51fd\u6570\uff0c\u5148\u628aname\u548cposition\u521d\u59cb\u5316\n        this.dept = dept;\n    }\n}\n\nvar manager = new Manager(&#039;\u738b\u4e94&#039;, &#039;\u7ecf\u7406&#039;,&#039;\u6280\u672f\u90e8&#039;);\nconsole.log(manager);\n\/** *\/\n\n\/*\u8986\u76d6\u95ee\u9898\n\/\/VH\uff1a\u590d\u5236\u5fc5\u8981\u4ee3\u7801\nclass Employee {\n    constructor(name,position){\n        this.name = name;\n        this.position = position;\n    }\n    signIn(){\n        console.log(this.name+&#039;\u6253\u5361\u4e0a\u73ed&#039;);\n    }\n}\n\/\/\u4e5f\u53ef\u4ee5\u7528super\u53bb\u8c03\u7528\u7236\u7c7b\u7684\u5176\u4ed6\u65b9\u6cd5\n\/\/\u5b50\u7c7b\u4e2d\u5199\u76f8\u540c\u65b9\u6cd5\uff0c\u8986\u76d6\u7236\u7c7b\u4e2d\u7684signIn()\u65b9\u6cd5\n\/\/\u5b50\u7c7b\u4e2dsignIn()\u518d\u53bb\u8c03\u7528\u7236\u7c7b\u7684signIn()\u540e\uff0c\u6dfb\u52a0\u81ea\u5df1\u7684\u8bed\u53e5\nclass Manager extends Employee{\n    constructor(name,position,dept){\n        super(name,position);\n        this.dept = dept;\n    }\n    signIn(){\/\/\u5b50\u7c7b\u4e2d\u5199\u76f8\u540c\u65b9\u6cd5\uff0c\u8986\u76d6\u7236\u7c7b\u4e2d\u7684signIn()\u65b9\u6cd5\n        super.signIn();\/\/\u53bb\u8c03\u7528\u7236\u7c7b\u7684signIn()\n        console.log(&#039;\u989d\u5916\u4fe1\u606f&#039;,&#039;\u7ecf\u7406\u6253\u5361&#039;);\/\/\u6dfb\u52a0\u81ea\u5df1\u7684\u8bed\u53e5\n    }\n};\n\nvar manager = new Manager(&#039;\u738b\u4e94&#039;, &#039;\u7ecf\u7406&#039;,&#039;\u6280\u672f\u90e8&#039;);\nconsole.log(manager);\nmanager.signIn();\n\/\/output\n\/\/ index.js:145Manager\u00a0{name: &quot;\u738b\u4e94&quot;, position: &quot;\u7ecf\u7406&quot;, dept: &quot;\u6280\u672f\u90e8&quot;}\n\/\/ index.js:84 \u738b\u4e94\u6253\u5361\u4e0a\u73ed\n\/\/ index.js:139 \u989d\u5916\u4fe1\u606f \u7ecf\u7406\u6253\u5361\n\/\/end\n\n\/** *\/\n\n\/*P77-\u9762\u5411\u5bf9\u8c61-\u6210\u5458\u53d8\u91cf*\/\n\/\/\u8001\u5e08\u53d1\u5e03\u89c6\u9891\u7684\u65f6\u5019\u8bf4\uff1a\u4ece\u8fd9\u5c0f\u8282\u5f00\u59cb\uff0c\u6240\u8bb2\u7684\u8bed\u6cd5\u90fd\u8fd8\u6ca1\u6709\u6b63\u5f0f\u53d1\u5e03\uff0c\u90e8\u5206\u6d4f\u89c8\u5668\u652f\u6301\uff0c\u6216\u8005\u901a\u8fc7bable\u7b49\u7f16\u8bd1\u5de5\u5177\u624d\u80fd\u591f\u5b9e\u73b0\n\/\/\u54b1\u4eec\u4f7f\u7528\u793a\u4f8b\u7684\u65f6\u5019\uff0c\u4fdd\u8bc1chrome80\u4ee5\u4e0a\u3010\u6211\u73b0\u5728\u4f7f\u7528\u7684\u662f360\u5b89\u5168\u6d4f\u89c8\u5668V10,Chrome\/86.0.4240.198\u3011\n\/\/\u6210\u5458\u53d8\u91cf\u662f\u6307:\u7c7b\u91cc\u9762\u5b9a\u4e49\u7684\u53d8\u91cf\n\n\/*\u521b\u5efa\u7c7b\uff0c\u4e0d\u8981\u6784\u9020\u51fd\u6570\nclass Employee{\n    dept = &#039;&#039;;\n}\nvar emp = new Employee();\nconsole.log(emp);\/\/Employee\u00a0{dept: &quot;&quot;}\n\n\/\/\u4e0a\u9762\u6253\u5370\u7ed3\u679c\u53ea\u6709\u4e00\u4e2a\u7a7a\u7684dept\u4fe1\u606f\uff0c\u6211\u4eec\u53ea\u80fd\u5728\u5916\u9762\u8bbe\u7f6edept\u5c5e\u6027\u7684\u503c\nemp.dept = &#039;\u6280\u672f\u90e8&#039;;\nconsole.log(emp);\/\/Employee\u00a0{dept: &quot;\u6280\u672f\u90e8&quot;}\n\/** *\/\n\n\/*\u521b\u5efa\u7c7b\uff0c\u4f7f\u7528\u6784\u9020\u51fd\u6570\n\/\/\u6210\u5458\u53d8\u91cf\u4e0e\u6784\u9020\u51fd\u6570\u7684\u533a\u522b\u662f\uff0c\u6784\u9020\u51fd\u6570\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e9b\u521d\u59cb\u5316\u903b\u8f91\n\/\/\u5982\u4e0b\u4f8b\uff1a\u6784\u9020this.name\u5c5e\u6027\u7684\u503c\u65f6\uff0c\u53ef\u4ee5\u5728\u53c2\u6570\u4f20\u5165\u540e\u524d\u9762\u52a0\u4e0a\u2018\u5458\u5de5\u59d3\u540d\u2019\nclass Employee{\n    dept = &#039;&#039;;\n    constructor(name){\n        this.name = &#039;\u5458\u5de5\u59d3\u540d\uff1a&#039;+name;\/\/VH\uff1a\u5bf9this.name\u5c5e\u6027\u503c\u8fdb\u884c\u52a0\u5de5\n    }\n}\nvar emp = new Employee(&#039;\u5cf0\u534e&#039;);\nconsole.log(emp);\/\/Employee\u00a0{dept: &quot;&quot;, name: &quot;\u5458\u5de5\u59d3\u540d\uff1a\u5cf0\u534e&quot;}\nemp.dept = &#039;\u6280\u672f\u90e8&#039;;\nconsole.log(emp);\/\/Employee\u00a0{dept: &quot;\u6280\u672f\u90e8&quot;, name: &quot;\u5458\u5de5\u59d3\u540d\uff1a\u5cf0\u534e&quot;}\n\nemp.dept2 = &#039;\u6280\u672f\u90e82&#039;;\nconsole.log(emp);\n\/\/\u6784\u9020\u51fd\u6570\u65b9\u4fbf\u521d\u59cb\u5316\u7684\u65f6\u5019\u4e00\u4e9b\u903b\u8f91\u64cd\u4f5c\uff0c\u5982\u4f8b\u5b50\u4e2d\u52a0\u4e0alabel\uff08\u201c\u5458\u5de5\u59d3\u540d\u201d\uff09\uff0c\u6216\u5176\u4ed6\u590d\u6742\u7684\u903b\u8f91\u64cd\u4f5c\n\/\/\u6210\u5458\u53d8\u91cfdept=&#039;&#039;\u7684\u65b9\u5f0f\uff0c\u53ea\u6709\u5728\u521d\u59cb\u5316\u7684\u65f6\u5019\u7ed9\u4e00\u4e2a\u503c\uff0c\u64cd\u4f5c\u903b\u8f91\u53ea\u80fd\u5728\u5916\u9762\uff0c\u6bcf\u6b21\u521b\u5efa\u5bf9\u8c61\u7684\u65f6\u5019\uff0c\u90fd\u9700\u8981\u81ea\u5df1\u53bb\u64cd\u4f5c\u8fd9\u4e2a\u903b\u8f91\n\/\/2\u8005\u5404\u6709\u5229\u5f0a\uff0c\u4f7f\u7528\u7684\u65f6\u5019\u8981\u6839\u636e\u81ea\u5df1\u7684\u7528\u9014\n\/\/\u6210\u5458\u53d8\u91cf\uff0c\u6784\u9020\u51fd\u6570\u4e2d\u7684\u5c5e\u6027\uff0c\u90fd\u53ef\u4ee5\u5728\u7c7b\u7684\u5176\u4ed6\u65b9\u6cd5\u4e2d\u4f7f\u7528\n\/** *\/\n\n\/*P78-\u9762\u5411\u5bf9\u8c61-\u9759\u6001\u6210\u5458\n\/\/\u9759\u6001\u6210\u5458\u53d8\u91cf\uff0c\u662fclass\u7ea7\u522b\u7684\uff0c\u53ea\u80fd\u901a\u8fc7\u7c7b\u6765\u8bbf\u95ee\u3002\n\/\/\u5b9a\u4e49\u9759\u6001\u6210\u5458\u53d8\u91cf\uff0c\u5b9a\u4e49\u9759\u6001\u6210\u5458\u65b9\u6cd5\uff0c\u4f7f\u7528static\u5173\u952e\u5b57\nclass Page{\/\/\u5927\u5c0f\u5199\u95ee\u9898,\u5e94\u8be5\u662f\u548c\u6784\u9020\u51fd\u6570\u4e00\u6837\u8981\u6c42\u5927\u5199\u3002\n    static count = 0;\n    static increaseViewCount(){\n        Page.count++;\n    }\n}\/\/\u4f3c\u4e4e\u90fd\u6ca1\u6709\u5206\u53f7\uff0c\u4ece\u5f00\u59cb\u5230\u73b0\u5728\u5b9a\u4e49\u51fd\u6570\u548c\u7c7b\u90fd\u6ca1\u6709\u7b26\u53f7\u5728\u672b\u5c3e\n\n\/\/\u53ea\u80fd\u901a\u8fc7Page.count\u6765\u8bbf\u95eecount\u7684\u503c\nPage.count++;\nconsole.log(Page.count);\/\/1\n\n\/\/\u53ea\u80fd\u901a\u8fc7Page.increaseViewCount()\u6765\u8c03\u7528increaseViewCount()\u51fd\u6570\nPage.increaseViewCount();\nconsole.log(Page.count);\/\/2\n\n\/\/\u8fd9\u6837\u597d\u5904\uff0c\u8ddf\u5168\u5c40\u7684\u53d8\u91cf\u7684\u533a\u522b\uff0c\u5c31\u662f\u7ed9\u5b83\u4e00\u4e2a\u4f5c\u7528\u57dfPage{}\uff0c\u6216\u8005\u7ed9\u5b83\u4e00\u4e2a\u5305\u540d\u6216\u5e93\u540d\uff0c\u7136\u540e\u9632\u6b62\u5b83\u7684\u547d\u540d\u51b2\u7a81\n\/\/Page\u91cc\u9762\u7684\u53d8\u91cf\u6216\u65b9\u6cd5\uff0c\u53ea\u80fd\u901a\u8fc7Page.count\uff0cPage.increaseViewCount\u6765\u8bbf\u95ee\n\/\/\u5047\u5982\u540e\u9762\u8fd8\u6709\u4e00\u4e2acount\uff08\u6bd4\u5982\u5b9a\u4e49\u4e00\u4e2acount\uff09\uff0c\u9632\u6b62\u8fd9\u4e24\u4e2a\u540d\u5b57\u51b2\u7a81\u3002\n\/\/VH\uff1a\u6211\u611f\u89c9\u8fd9\u4e2a\u9759\u6001\u6210\u5458\u867d\u7136\u540d\u5b57\u662fstatic\u9759\u6001\u4f46\u662f\u503c\u53ef\u4ee5\u53d8\uff0c\u770b\u4f8b\u5b50\u5c31\u77e5\u9053\u3002\u7528const\u5b9a\u4e49\u5e38\u91cf\u5c31\u4e0d\u80fd\u6539\u3002\u6bd4\u5982const NUM = 2;\n\n\/\/\u7ed3\u675f\u8bed\uff1a\u8fd8\u6709\u5176\u4ed6\u7684\u4e00\u4e9b\u79c1\u6709\u6210\u5458\u548c\u79c1\u6709\u6210\u5458\u65b9\u6cd5\uff0c\u6d4f\u89c8\u5668\u6682\u65f6\u8fd8\u4e0d\u652f\u6301\uff0c\u5c31\u5148\u4e0d\u6f14\u793a\u4e86\u3002\u7b49\u652f\u6301\u7684\u65f6\u5019\uff0c\u518d\u628a\u8bfe\u7a0b\u8865\u4e0a\n\/** *\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/*P74-\u9762\u5411\u5bf9\u8c61-\u5b9a\u4e49class \/\/\u5176\u4ed6\u9762\u5411\u5bf9\u8c61\u8bed\u8a00\u7684\u6838\u5fc3\u7ed3\u6784-class\uff08\u7c7b\uff09 \/\/\u4e0eJS\u7684\u539f\u578b\u7c7b\u4f3c\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"_links":{"self":[{"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/posts\/914"}],"collection":[{"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/comments?post=914"}],"version-history":[{"count":1,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/posts\/914\/revisions"}],"predecessor-version":[{"id":915,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/posts\/914\/revisions\/915"}],"wp:attachment":[{"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/media?parent=914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/categories?post=914"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/tags?post=914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}