Skip to content

Commit

Permalink
feat(vue2): devtools.hide option support, closes #1444
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed May 24, 2021
1 parent 5d6ba0e commit 7459947
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/app-backend-vue2/src/components/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function capture (instance, index?: number, list?: any[]): ComponentTreeNode {
instance = instance._vnode.componentInstance
}

if (instance.$options?.devtools?.hide) return

// Functional component.
if (instance.fnContext && !instance.componentInstance) {
const contextUid = instance.fnContext.__VUE_DEVTOOLS_UID__
Expand Down
11 changes: 11 additions & 0 deletions packages/shell-dev-vue2/src/Hidden.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script>
export default {
devtools: {
hide: true
}
}
</script>

<template>
<div>I'm hidden in the devtools</div>
</template>
4 changes: 3 additions & 1 deletion packages/shell-dev-vue2/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import MyClass from './MyClass.js'
import router from './router'
import TransitionExample from './TransitionExample.vue'
import Router from './router/Router.vue'
import Hidden from './Hidden.vue'

window.VUE_DEVTOOLS_CONFIG = {
openInEditorHost: '/'
Expand Down Expand Up @@ -45,7 +46,8 @@ const app = new Vue({
h(TransitionExample),
h(VuexObject),
h(Init),
h(RefTester)
h(RefTester),
h(Hidden)
])
}
})
Expand Down

0 comments on commit 7459947

Please sign in to comment.