File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/schema-org/runtime/components Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export const SchemaOrgDebug = defineComponent({
8
8
default : false ,
9
9
} ,
10
10
} ,
11
- setup ( ) {
11
+ setup ( props ) {
12
12
const schemaRaw = ref ( '' )
13
13
let observer : MutationObserver
14
14
@@ -20,7 +20,7 @@ export const SchemaOrgDebug = defineComponent({
20
20
21
21
const fetchSchema = ( ) => {
22
22
$el = document . querySelector ( 'script[data-id="schema-org-graph"]' )
23
- schemaRaw . value = $el ?. innerText
23
+ schemaRaw . value = $el ?. textContent || ''
24
24
}
25
25
26
26
// Create an observer instance linked to the callback function
@@ -38,6 +38,13 @@ export const SchemaOrgDebug = defineComponent({
38
38
} )
39
39
} )
40
40
41
+ if ( props . console ) {
42
+ watch ( schemaRaw , ( val ) => {
43
+ // eslint-disable-next-line no-console
44
+ console . info ( '[SchemaOrgDebug]' , JSON . parse ( val ) )
45
+ } )
46
+ }
47
+
41
48
onBeforeUnmount ( ( ) => {
42
49
observer ?. disconnect ( )
43
50
} )
You can’t perform that action at this time.
0 commit comments