代码
<script type="text/javascript"> const _proxy = (object, ...prototypes) => { // 补全代码 let proxy = new Proxy(object, { get(target, props) { let index = prototypes.indexOf(props); if (index !== -1) { return 'noright'; } else { return object[props]; } }, }); return proxy; }; </script>
思路
就是在获取object对象属性时,判断该属性在不在prototypes中即可