闪屏修复-关于我们

This commit is contained in:
WindowBird 2025-10-16 09:52:07 +08:00
parent 5ea85aed4e
commit 277028119c
2 changed files with 17 additions and 53 deletions

View File

@ -1,57 +1,5 @@
<script lang="ts" setup>
import {onMounted} from "vue";
onMounted(() => {
// CSS
loadCSSFiles()
// JavaScript
loadJSFiles()
})
const loadJSFiles = () => {
const jsFiles = [
'/js/bootstrap.min.js',
'/js/gopcOm.js',
'/js/index.js',
'/js/jquery-1.10.2.js',
]
jsFiles.forEach(src => {
// JS
const existingScript = document.querySelector(`script[src="${src}"]`)
if (!existingScript) {
const script = document.createElement('script')
script.src = src
script.type = 'text/javascript'
document.head.appendChild(script)
}
})
}
const loadCSSFiles = () => {
const cssFiles = [
'/css/bootstrap.min.css',
'/css/main2.css',
'/css/about2019.css',
'/css/yuxi2019.css'
]
cssFiles.forEach(href => {
// CSS
const existingLink = document.querySelector(`link[href="${href}"]`)
if (!existingLink) {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = href
link.type = 'text/css'
document.head.appendChild(link)
}
})
}
// 使 useHead
</script>
<template>

View File

@ -1,4 +1,20 @@
<script lang="ts" setup>
import {useHead} from "#app";
// 使 Nuxt 3 useHead
useHead({
link: [
{rel: 'stylesheet', href: '/css/bootstrap.min.css'},
{rel: 'stylesheet', href: '/css/main2.css'},
{rel: 'stylesheet', href: '/css/about2019.css'},
{rel: 'stylesheet', href: '/css/yuxi2019.css'}
],
script: [
{src: '/js/index.js'},
{src: '/js/gopcOm.js'}
]
})
//
// definePageMeta({
// layout: 'about'