-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Description
TL;DR:
when we use Vue.use
to add a plugin, which render a component instance(with Vue.extend
), and the component $emit events with vue instance as payload. It cause vue warns.
version:
vue(>2.0.0) vue-devtool(latest)
demo:
codepen
(can't reproduce the bug unless u copy the code, start a demo and open vue-devtool)
bug:
vue warns: Property or method "toJSON" is not defined
facts:
- JSON.stringify would try to call
toJSON
attr when it meets object. spec - vue-devtool use JSON.stringify (or circular-json-es6) to deep copy(I guess) the $emit payload
- vue use Proxy(_renderProxy) to warn
not defined
attr or method during render indevelop mode
- vue call the
_init
function (which included _renderProxy) in Vue and Vue.extend(produce _Ctor)
reason
- vue-devtool find out a $emit, try to use JSON.stringify, JSON.stringify meet _Ctor attr first than circular reference
- _Ctor[0] has
_renderProxy
, JSON.stringify try to calltoJSON
, cause getHandler to warn. - it's a rare bug, because it happens only when
_renderPorxy
is reached before circular reference.
but, it's real confusing...
mgthomas99, mackmm145, xiaohui-zhangxh, sauron0914, zzhi191 and 1 more
Metadata
Metadata
Assignees
Labels
No labels