数据结构优化
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<div class="flex items-center gap-4">
|
||||
<CustomSelect
|
||||
v-model="selectedLanguage"
|
||||
:options="languageOptions.filter(opt => !opt.disabled)"
|
||||
:options="languageOptions"
|
||||
@update:modelValue="handleLanguageChange"
|
||||
placeholder="选择语言"
|
||||
style="width: 180px; font-family: monospace; font-size: 0.75rem;"
|
||||
@@ -449,13 +449,15 @@ const getConsoleTemplate = (jsCode: string) => {
|
||||
`
|
||||
}
|
||||
|
||||
let runTimer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
const handleCodeChange = () => {
|
||||
highlightCode()
|
||||
// 对于非 Web 语言(如 Python/React),不自动运行,等待用户点击 Run
|
||||
if (['html', 'css', 'javascript'].includes(selectedLanguage.value)) {
|
||||
// Debounce auto-run for lightweight languages
|
||||
clearTimeout(window.runTimer)
|
||||
window.runTimer = setTimeout(() => runCode(), 1000)
|
||||
if (runTimer) clearTimeout(runTimer)
|
||||
runTimer = setTimeout(() => runCode(), 1000)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<template>
|
||||
<footer class="py-8 text-center border-t border-white/5 relative z-10">
|
||||
<div class="flex justify-center items-center gap-4 mb-4">
|
||||
<a @click="window.open('admin.html', '_blank')" class="text-xs text-art-muted/30 hover:text-art-accent cursor-pointer">管理入口</a>
|
||||
<a @click="openAdmin" class="text-xs text-art-muted/30 hover:text-art-accent cursor-pointer">管理入口</a>
|
||||
</div>
|
||||
<p class="text-art-muted text-xs font-mono tracking-widest opacity-50">© 2024 年糕崽崽. 保留所有权利.</p>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// Footer组件的逻辑可以在这里添加
|
||||
const openAdmin = () => {
|
||||
window.open('admin.html', '_blank')
|
||||
}
|
||||
</script>
|
||||
@@ -6,7 +6,7 @@
|
||||
<a @click="navigate('/works')" class="font-serif text-3xl italic text-white hover:text-art-accent cursor-pointer">作品</a>
|
||||
<a @click="navigate('/snippets')" class="font-serif text-3xl italic text-white hover:text-art-accent cursor-pointer">代码</a>
|
||||
<a @click="navigate('/about')" class="font-serif text-3xl italic text-white hover:text-art-accent cursor-pointer">关于</a>
|
||||
<a @click="window.open('admin.html', '_blank')" class="font-mono text-sm text-art-muted mt-8">管理入口</a>
|
||||
<a @click="openAdmin" class="font-mono text-sm text-art-muted mt-8">管理入口</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -30,6 +30,10 @@ const navigate = (target: string) => {
|
||||
toggleMobileMenu()
|
||||
}
|
||||
|
||||
const openAdmin = () => {
|
||||
window.open('admin.html', '_blank')
|
||||
}
|
||||
|
||||
const refreshIcons = () => {
|
||||
if ((window as any).lucide) {
|
||||
(window as any).lucide.createIcons()
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted, computed, nextTick } from 'vue'
|
||||
import { ref, watch, computed, nextTick } from 'vue'
|
||||
import hljs from 'highlight.js'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -90,7 +90,6 @@ const emit = defineEmits(['close'])
|
||||
const isAnimating = ref(true)
|
||||
const mouseX = ref(0)
|
||||
const mouseY = ref(0)
|
||||
const containerRect = ref<DOMRect | null>(null)
|
||||
const codeBlock = ref<HTMLElement | null>(null)
|
||||
|
||||
const languageClass = computed(() => {
|
||||
|
||||
@@ -178,7 +178,7 @@ const closeDropdown = (e: MouseEvent) => {
|
||||
}
|
||||
|
||||
const handleChangePassword = () => {
|
||||
toast.showToast('功能开发中...', 'info')
|
||||
toast.showToast('功能开发中...', 'success')
|
||||
isUserDropdownOpen.value = false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user