{"id":165185,"date":"2020-09-29T23:33:55","date_gmt":"2020-09-29T15:33:55","guid":{"rendered":"http:\/\/4563.org\/?p=165185"},"modified":"2020-09-29T23:33:55","modified_gmt":"2020-09-29T15:33:55","slug":"%e4%bd%9c%e4%b8%ba-javascript-%e7%9a%84%e4%b8%80%e4%b8%aa%e5%86%85%e7%bd%ae%e5%87%bd%e6%95%b0%ef%bc%8c%e4%b8%ba%e4%bb%80%e4%b9%88-proxy-%e6%b2%a1%e6%9c%89-prototype-%e8%bf%99%e4%b8%aa%e5%b1%9e","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=165185","title":{"rendered":"\u4f5c\u4e3a JavaScript \u7684\u4e00\u4e2a\u5185\u7f6e\u51fd\u6570\uff0c\u4e3a\u4ec0\u4e48 Proxy \u6ca1\u6709 prototype \u8fd9\u4e2a\u5c5e\u6027\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4f5c\u4e3a JavaScript \u7684\u4e00\u4e2a\u5185\u7f6e\u51fd\u6570\uff0c\u4e3a\u4ec0\u4e48 Proxy \u6ca1\u6709 prototype \u8fd9\u4e2a\u5c5e\u6027\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : KyL <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>var proxy = new Proxy(target, handler);<\/p>\n<p>console.log(Proxy.prototype);<\/p>\n<p>Proxy \u662f\u4e00\u4e2a\u65b9\u6cd5\uff0c\u53ef\u662f\u6211\u5728 Chrome \u4e2d\u5c1d\u8bd5\u8bbf\u95ee Proxy.prototype \u5374\u4e3a undefined\uff0c\u5728 node \u4e2d\u4e3a null \u3002Proxy \u8fd9\u4e2a\u51fd\u6570\u6709\u4ec0\u4e48\u7279\u522b\u4e4b\u5904\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3631376\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : aaronlam <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u9996\u5148\u6784\u9020\u65b9\u6cd5\u7684 prototype \u4e0d\u4e00\u5b9a\u662f\u4e3a\u5bf9\u8c61\u7684\u5440\uff0c\u53ef\u4ee5\u7f6e\u4e3a null \u7684<\/p>\n<p>\u53e6\u5916\u53ef\u4ee5\u770b\u4e0b ECMA \u5bf9\u4e8e Proxy \u6784\u9020\u51fd\u6570\u7684\u89c4\u8303\uff1a<br \/>http:\/\/www.ecma-international.org\/ecma-262\/#sec-proxy-constructor<\/p>\n<p>26.2.2 Properties of the Proxy Constructor<br \/> \u00b7has a [[Prototype]] internal slot whose value is %Function.prototype%.<br \/> \u00b7does not have a &#8220;prototype&#8221; property because proxy exotic objects do not have a [[Prototype]] <br \/>internal slot that requires initialization.<\/p>\n<p>\u7531\u4e8e Proxy \u6784\u9020\u51fa\u6765\u7684\u5b9e\u4f8b\u5bf9\u8c61\u662f\u5bf9 target \u7684\u4e00\u4e2a\u4ee3\u7406\uff0c\u6240\u4ee5 Proxy \u5728\u6784\u9020\u8fc7\u7a0b\u4e2d\u662f\u4e0d\u9700\u8981 prototype \u8fdb\u884c\u521d\u59cb\u5316\u7684\u3002<br \/>\u53e6\u5916\u6211\u8bb0\u5f97\u6b63\u5e38\u7684\u6784\u9020\u51fd\u6570\u5728 new \u8fd0\u7b97\u7684\u65f6\u5019\uff0c\u662f\u9996\u5148\u4f1a\u53d6\u6784\u9020\u51fd\u6570\u7684 prototype \u53bb\u6784\u5efa\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u7136\u540e\u518d\u4f20\u5165\u6784\u9020\u51fd\u6570\u5185\u5145\u5f53 this\uff0c\u518d\u5c31\u662f\u6784\u9020\u51fd\u6570\u8fdb\u884c\u521d\u59cb\u5316\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3631377\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xionger <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u6ca1\u6709\u7528\u8fc7                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u4e3a JavaScript \u7684\u4e00\u4e2a&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/165185"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=165185"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/165185\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=165185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=165185"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=165185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}