Vue技术6.2何为数据代理

DOCTYPE html>>
<html>
    <head>
        <mata charset="UTF-8" />
        <title>何为数据代理title>
    head>
    <body>
        
        <script type="text/javascript">
            let obj = {x:100}
            let obj2 = {y:200}

            Object.defineProperty(obj2,'x',{
                get(){
                    return obj.x
                },
                set(value){
                    obj.x = value
                }
            })
        script>
    body>
html>

你可能感兴趣的:(前端,vue.js,javascript,ecmascript)