Explorar o código

test user agent

Olivier Massot hai 1 ano
pai
achega
0729807285
Modificáronse 3 ficheiros con 7 adicións e 1 borrados
  1. 1 0
      .eslintrc.cjs
  2. 1 1
      app.vue
  3. 5 0
      components/Layout/Navigation.vue

+ 1 - 0
.eslintrc.cjs

@@ -48,5 +48,6 @@ module.exports = {
     useClientDevice: 'readonly',
     useSeoMeta: 'readonly',
     onNuxtReady: 'readonly',
+    useLocaleHead: 'readonly',
   },
 }

+ 1 - 1
app.vue

@@ -19,6 +19,6 @@ layoutStore.resetAnchoredSections()
 const i18nHead = useLocaleHead({
   addDirAttribute: true,
   identifierAttribute: 'id',
-  addSeoAttributes: true
+  addSeoAttributes: true,
 })
 </script>

+ 5 - 0
components/Layout/Navigation.vue

@@ -3,6 +3,7 @@ Menu Navigation
 -->
 <template>
   <div v-intersect="onIntersect">
+    <div v-show="false">{{ agent }}</div>
     <!-- Navigation (écran large) -->
     <div v-if="lgAndUp || (!isMobileDevice() && !nuxtReady)">
       <LayoutNavigationLg :menu="menu" />
@@ -17,6 +18,7 @@ Menu Navigation
 
 <script setup lang="ts">
 import { useDisplay } from 'vuetify'
+import { useRequestHeaders } from '#app'
 import type { MainMenuItem } from '~/types/interface'
 import { useLayoutStore } from '~/stores/layoutStore'
 import { useClientDevice } from '~/composables/useClientDevice'
@@ -27,6 +29,9 @@ onNuxtReady(() => {
   nuxtReady.value = true
 })
 
+const headers = useRequestHeaders()
+const agent = headers['user-agent']
+
 const { lgAndUp } = useDisplay()
 
 const { isMobileDevice } = useClientDevice()