• jQuery.proxy
    • ES6的proxy
    • DOM事件代理

    举个例子:

    1. let start = {
    2. name: 'xxx',
    3. age: 18,
    4. phone: 12212212122
    5. }
    6. let agent = new Proxy(stat, {
    7. get: function(target, key) {
    8. if (key === 'phone') {
    9. return 'anent_phone: 13313313133'
    10. }
    11. if (key === 'price') {
    12. return 120000
    13. }
    14. return target[key]
    15. }
    16. set: function(target, key, value) {
    17. // 自定义逻辑来设置value
    18. }
    19. })