1234567891011121314151617181920212223242526272829303132 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <!--
- Proxy 代理
- -->
- <script>
- let obj = {
- name:"Tom"
- }
- // 实例化对象
- let vase = new Proxy(obj,{
- get(target,key,prototype) {
- console.log(target,'target')
- console.log(key,'key')
- console.log(prototype,'prototype')
- return target;
- },
- set() {
- }
- });
- console.log(vase.get.name,'打印')
- </script>
- </body>
- </html>
|