@@ -7,6 +7,10 @@ const hostOpts = inspectorOptions.serverOptions?.host
7
7
const host = hostOpts && hostOpts !== true ? hostOpts : importMetaUrl? .hostname
8
8
const port = inspectorOptions .serverOptions ? .port ?? importMetaUrl? .port
9
9
const baseUrl = isClient ? ` ${ protocol} //${ host} :${ port} ` : ' '
10
+
11
+ const KEY_DATA = ' data-v-inspector-options'
12
+ const KEY_IGNORE = ' data-v-inspector-ignore'
13
+
10
14
export default {
11
15
name: ' VueInspectorOverlay' ,
12
16
data () {
@@ -27,6 +31,7 @@ export default {
27
31
line: 0 ,
28
32
column: 0 ,
29
33
},
34
+ KEY_IGNORE ,
30
35
}
31
36
},
32
37
computed: {
@@ -123,17 +128,25 @@ export default {
123
128
getTargetNode (e ) {
124
129
const splitRE = / (. + ):([\d ] + ):([\d ] + )$ /
125
130
const path = e .path ?? e .composedPath ()
126
- const targetNode = path? .find (node => node? .hasAttribute ? .(' data-v-inspector-options' ))
127
- if (this .isChildOf (targetNode, this .$refs .containerRef ) || ! targetNode) {
131
+ if (! path) {
132
+ return {
133
+ targetNode: null ,
134
+ params: null ,
135
+ }
136
+ }
137
+ const ignoreIndex = path .findIndex (node => node? .hasAttribute ? .(KEY_IGNORE ))
138
+ const targetNode = path .slice (ignoreIndex + 1 ).find (node => node? .hasAttribute ? .(KEY_DATA ))
139
+ if (! targetNode) {
128
140
return {
129
141
targetNode: null ,
130
142
params: null ,
131
143
}
132
144
}
133
- const [_ , file , line , column ] = targetNode? .getAttribute ? .(' data-v-inspector-options' )? .match (splitRE)
145
+ const match = targetNode .getAttribute (KEY_DATA )? .match (splitRE)
146
+ const [_ , file , line , column ] = match || []
134
147
return {
135
148
targetNode,
136
- params: targetNode
149
+ params: match
137
150
? {
138
151
file,
139
152
line,
@@ -207,7 +220,7 @@ export default {
207
220
< / script>
208
221
209
222
< template>
210
- < div>
223
+ < div v - bind = " { [KEY_IGNORE]: 'true' } " >
211
224
< div
212
225
v- if = " containerVisible"
213
226
ref= " containerRef"
@@ -254,7 +267,7 @@ export default {
254
267
< / a>
255
268
< / div>
256
269
<!-- Overlay -->
257
- < template v- if = " overlayVisible" >
270
+ < template v- if = " overlayVisible && linkParams " >
258
271
< div
259
272
ref= " floatsRef"
260
273
class = " vue-inspector-floats vue-inspector-card"
0 commit comments