app.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!-- @format -->
  2. <script setup>
  3. import '@unocss/reset/tailwind.css'
  4. import LoginModal from '~/components/common/login/index.vue'
  5. const { isLoginModalOpen } = useLoginModal()
  6. const router = useRouter()
  7. router.beforeEach(() => {
  8. const timer = setTimeout(() => {
  9. const dom = document.getElementById('app-scroller')
  10. dom.scrollTo({
  11. top: 0,
  12. behavior: 'smooth',
  13. })
  14. clearTimeout(timer)
  15. }, 500)
  16. })
  17. useHead({
  18. script: [
  19. // Google Tag Manager
  20. // {
  21. // children: `(function (w, d, s, l, i) {
  22. // w[l] = w[l] || []
  23. // function gtag() { w[l].push(arguments) }
  24. // w.$gtag = gtag
  25. // const j = d.createElement(s)
  26. // j.src = "https://www.googletagmanager.com/gtag/js?id=" + i
  27. // j.async = true
  28. // j.onload = function () {
  29. // gtag("js", new Date())
  30. // gtag("config", i)
  31. // }
  32. // d.head.appendChild(j)
  33. // })(window, document, "script", "dataLayer", "G-XNX7ZDX7QY")`,
  34. // },
  35. // 第三方客服工具
  36. // {
  37. // children: `!function(){const c=document.createElement("script");c.src="https://plugin-code.salesmartly.com/js/project_270819_277882_1741848946.js",c.async=!0,c.onload=function(){window.__ssc.setting={hideIcon:!1}},document.head.appendChild(c)}();`,
  38. // },
  39. // JSON-LD
  40. {
  41. type: 'application/ld+json',
  42. children: JSON.stringify({
  43. datePublished: '2024-12-01T00:00:00.000Z',
  44. dateModified: new Date().toISOString(),
  45. }),
  46. },
  47. ],
  48. noscript: [
  49. // Google Tag Manager (noscript)
  50. {
  51. children: '<iframe src="https://www.googletagmanager.com/gtag/js?id=G-XNX7ZDX7QY" height="0" width="0" style="display:none;visibility:hidden"></iframe>', // 替换为您的 GTM ID
  52. tagPosition: 'bodyOpen',
  53. },
  54. ],
  55. })
  56. </script>
  57. <template>
  58. <NuxtLayout>
  59. <NuxtPage />
  60. <LoginModal v-if="isLoginModalOpen" />
  61. </NuxtLayout>
  62. </template>
  63. <style lang="less">
  64. .page-enter-active,
  65. .page-leave-active {
  66. transition: opacity .5s;
  67. }
  68. .page-enter-from,
  69. .page-leave-to {
  70. opacity: 0;
  71. }
  72. html,
  73. body,
  74. #__nuxt {
  75. height: 100vh;
  76. margin: 0;
  77. padding: 0;
  78. background: #fff;
  79. color: var(--primary-color);
  80. font-size: var(--font-size-base);
  81. font-family: 'CommonFont';
  82. }
  83. </style>