-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
更新到0.11.0-rc3后遇到watcher.js
报错
#520
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
Comments
Hi, 非常感谢这么详细的报告,我想再对根本原因定位一下,能不能在出错的地方放个 debugger: try {
for (var i = 0, l = cbs.length; i < l; i++) {
cbs[i](value, oldValue)
}
} catch (e) { debugger } 然后让我看下出来的 stack trace 截图?或者展开那个错误的 stack trace 也可以 |
yyx990803
added a commit
that referenced
this issue
Oct 29, 2014
应该解决了,你按 |
正常了,赞! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
觉得可能是个bug,所以就直接用中文描述了。。
报错页面的逻辑有点复杂,没能抽出纯粹的Demo,但已查到直接原因。
报错的截图如下:

出错场景还原如下:
[update, update]
,l == cbs.length == 2
。i == 0
,执行第一个update
,执行后满足teardown的条件,进入_teardown()
。_teardown()
中满足条件进入removeCb()
,然后执行cbs.splice(i, 1)
,cbs变为[update]
。i == 1, l == 2
,i<l == true
,遍历到第二个元素,但此时cbs的长度已变为1,cbs[1] == undefined
。cbs[1] == undefined
被作为函数执行,浏览器报错。相关代码的位置:
https://github.com/yyx990803/vue/blob/0.11.0-rc3/dist/vue.js#L2174
https://github.com/yyx990803/vue/blob/0.11.0-rc3/dist/vue.js#L2202
小结一下出错的条件:cbs长度>1,且非末位数组元素的执行触发了removeCb。
但不知
update(value, oldValue)
在怎样的情况下会进入teardown逻辑,我再试试能不能抽出纯粹的Demo。The text was updated successfully, but these errors were encountered: