当前位置 博文首页 > cuk0051的博客:JavaScript代理对象

    cuk0051的博客:JavaScript代理对象

    作者:[db:作者] 时间:2021-09-09 16:46

    When working with objects, we can create a proxy object that intercepts and changes the behavior of an existing object.

    使用对象时,我们可以创建一个代理对象 ,该代理对象可以拦截并更改现有对象的行为。

    We do so using the Proxy native object, introduced in ES2015.

    我们使用ES2015中引入的Proxy本机对象进行此操作。

    Suppose we have a car object:

    假设我们有一个car对象:

    const car = {
      color: 'blue'
    }
    cs