app.vue 2.4 KB

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