app.vue 2.1 KB

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