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

这里监听的index 返回undefined #17

Closed
alexljk opened this issue Mar 27, 2018 · 5 comments
Closed

这里监听的index 返回undefined #17

alexljk opened this issue Mar 27, 2018 · 5 comments

Comments

@alexljk
Copy link

alexljk commented Mar 27, 2018

{
watchers: {
'users.*.name': function (newValue, oldValue, keypath, index) {
console.log('第' + index + '个用户的名称变化了');
}
}
}

@musicode
Copy link
Contributor

新版本把这个 feature 去掉了,只保留前三个参数

@musicode
Copy link
Contributor

刚更新了文档

@alexljk
Copy link
Author

alexljk commented Mar 27, 2018

拿我早上的列子举例:
data: {
it: [{
"GysName": "A",
"Cbks": false,
"listcg": [{
"Num": 1,
"Multiple": 24,
"GID": 6800,
"Cbk": false
}, {
"Num": 10,
"Multiple": 10,
"GID": 9857,
"Cbk": true
}, {
"Num": 10,
"Multiple": 10,
"GID": 10013,
"Cbk": true
}]
}, {
"GysName": "B",
"Cbks": false,
"listcg": [{
"Num": 1,
"Multiple": 24,
"GID": 17739,
"Cbk": false
}]
}]
},

我需要设置全选和非全选 这个时候 我监听了'it.*.Cbks' 当点击外层的cbks的时候 我需要把listcg.cbk 做处理
这个时候 我拿不到index,是不是去对keypath 做处理?

@musicode
Copy link
Contributor

是的,自己取,框架不做这事,因为对大部分场景来说,不需要这个参数,框架做是浪费性能

@alexljk
Copy link
Author

alexljk commented Mar 27, 2018

恩好的

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

2 participants