File tree 2 files changed +32
-1
lines changed
2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ onMounted(() => {
121
121
<template #sidebarTop />
122
122
</TwoColLayoutWStickySideBar>
123
123
124
- <page-anchor
124
+ <PageAnchor
125
125
v-if =" h2Array.length >= 3"
126
126
:section-titles =" h2Array"
127
127
/>
Original file line number Diff line number Diff line change
1
+ // Find all elements with class name "section-header2" or "section-header3"
2
+ // Loop through each section-header element and push it into the array
3
+ // Excludes the section-header2 More Information which is a visually-hidden element above the divider-way-finder in the Flexible Block component
4
+
5
+ function getHeadersMethod ( ) {
6
+ const elements = document . querySelectorAll ( '.section-header2, .section-header3, section-header4' )
7
+
8
+ const h2Array = [ ]
9
+
10
+ elements . forEach ( ( element ) => {
11
+ if ( element . textContent !== 'More Information' ) {
12
+ h2Array . push ( element . textContent )
13
+ }
14
+ } )
15
+
16
+ // console.log('The plugin has been mounted!')
17
+ // console.log('h2Array:', h2Array)
18
+
19
+ return h2Array
20
+ }
21
+
22
+ export default defineNuxtPlugin ( ( ) => {
23
+ return {
24
+ provide : {
25
+ getHeaders : {
26
+ getHeadersMethod
27
+ // Make plugin available to all components
28
+ }
29
+ }
30
+ }
31
+ } )
You can’t perform that action at this time.
0 commit comments