Skip to content

Commit

Permalink
feat: support nested instance debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
王震西 committed May 12, 2020
1 parent 933063f commit 8b53d66
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions packages/app-backend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ function scan () {
}
}

if (isBrowser) {
walk(document, function (node) {
function walkNode(element) {
let elements = []
walk(element, function (node) {
if (inFragment) {
if (node === currentFragment._fragmentEnd) {
inFragment = false
Expand All @@ -239,8 +240,22 @@ function scan () {
}
let instance = node.__vue__

return processInstance(instance)
const isVue = processInstance(instance)
if (isVue) {
// to find sub Vue instance
if (node.childNodes) {
elements.push(...node.childNodes)
}
}
return isVue
})
if (elements.length) {
elements.forEach(walkNode)
}
}

if (isBrowser) {
walkNode(document)
} else {
if (Array.isArray(target.__VUE_ROOT_INSTANCES__)) {
target.__VUE_ROOT_INSTANCES__.map(processInstance)
Expand Down

0 comments on commit 8b53d66

Please sign in to comment.