@@ -10,6 +10,17 @@ import { instance, onVueInstanceUpdate } from '~/logic/app'
10
10
import { rootPath } from ' ~/logic/global'
11
11
12
12
const componentTree = ref <ComponentTreeNode []>([])
13
+ const filterName = ref (' ' )
14
+
15
+ const componentWalker = shallowRef <ComponentWalker | null >(null )
16
+
17
+ watchDebounced (filterName , (value ) => {
18
+ value = value .trim ().toLowerCase ()
19
+ componentWalker .value ! .componentFilter .setFilter (value )
20
+ componentWalker .value ! .getComponentTree (instance .value ! ).then ((res ) => {
21
+ componentTree .value = res
22
+ })
23
+ }, { debounce: 200 })
13
24
14
25
function normalizeComponentState(value : unknown , type : string ) {
15
26
if (type === ' Reactive' )
@@ -48,10 +59,10 @@ const normalizedComponentState = computed(() => {
48
59
})
49
60
50
61
function init() {
51
- const walker = new ComponentWalker (500 , null , true )
62
+ componentWalker . value = new ComponentWalker (500 , null , true )
52
63
selectedComponent .value = instance .value
53
64
selectedComponentState .value = getInstanceState (instance .value ! )
54
- walker .getComponentTree (instance .value ! ).then ((res ) => {
65
+ componentWalker . value .getComponentTree (instance .value ! ).then ((res ) => {
55
66
componentTree .value = res
56
67
selectedComponentName .value = res ?.[0 ]?.name ?? ' '
57
68
selectedComponentNode .value = res ?.[0 ]
@@ -77,6 +88,9 @@ function openInEditor() {
77
88
<div h-screen n-panel-grids >
78
89
<Splitpanes >
79
90
<Pane border =" r base" >
91
+ <div v-if =" componentWalker" w-full px10px py12px >
92
+ <VDTextInput v-model =" filterName" placeholder =" Find components..." />
93
+ </div >
80
94
<div h-screen select-none overflow-scroll p-2 class =" no-scrollbar" >
81
95
<ComponentTreeNode v-for =" (item) in componentTree" :key =" item.id" :data =" item" />
82
96
</div >
0 commit comments