Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defineReactive函数第一行 #57

Open
Heyangzhouzz opened this issue Apr 29, 2019 · 1 comment
Open

defineReactive函数第一行 #57

Heyangzhouzz opened this issue Apr 29, 2019 · 1 comment

Comments

@Heyangzhouzz
Copy link

Heyangzhouzz commented Apr 29, 2019

function defineReactive (obj, key, val, cb) {
    let val = val
    Object.defineProperty(obj, key, {
        enumerable: true,
        configurable: true,
        get: ()=>{
            /*....依赖收集等....*/
            /*Github:https://github.com/answershuto*/
            return val
        },
        set:newVal=> {
            val = newVal;
            cb();/*订阅者收到消息的回调*/
        }
    })
}
@isdotjim
Copy link

搭个车...
想邀请Repo参与者来w3c.group创建项目的对应小组。w3c.group是类似知识星球的社群工具,小组可设置为付费且有赞助功能,同时也是一个区块链主导的创作者社区。这是相关介绍:
http://t.cn/Ai1vLcCU
http://t.cn/Ai1vLcCG
http://t.cn/Ai1vLcCA

@Rehtt97
Copy link

Rehtt97 commented Jun 8, 2021

兄嘚,你这个写法有问题吧 应该会报这种错

Uncaught SyntaxError: Identifier 'val' has already been declared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants