调整项目结构:前端和 Electron 核心

This commit is contained in:
2025-08-06 07:44:19 +08:00
parent 499f6205fa
commit cbe3f72d1c
19 changed files with 3836 additions and 1329 deletions

View File

@ -1,30 +1,77 @@
<script setup>
import HelloWorld from './components/HelloWorld.vue'
import { ref, onMounted } from 'vue'
import petVideo from './assets/pet.mp4'
const tooltips = [
"说的道理",
]
const sounds = [
]
const showTooltip = ref(false)
const currentTooltip = ref('')
const handleClick = () => {
// 随机播放音效
const sound = sounds[Math.floor(Math.random() * sounds.length)]
window.electronAPI.playSound(sound)
// 随机显示提示
showTooltip.value = true
currentTooltip.value = tooltips[Math.floor(Math.random() * tooltips.length)]
setTimeout(() => showTooltip.value = false, 2000)
}
</script>
<template>
<div>
<a href="https://vite.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
<div class="container">
<!-- MP4素材播放 -->
<video
autoplay loop muted
:src="petVideo"
@click="handleClick"
/>
<!-- 文字提示框 -->
<transition name="fade">
<div v-if="showTooltip" class="tooltip">
{{ currentTooltip }}
</div>
</transition>
</div>
<HelloWorld msg="Vite + Vue" />
</template>
<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
.container {
width: 100vw;
height: 100vh;
overflow: hidden;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
video {
width: 100%;
height: 100%;
object-fit: contain;
cursor: pointer;
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
.tooltip {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.7);
color: white;
padding: 8px 16px;
border-radius: 20px;
font-size: 14px;
}
</style>
.fade-enter-active, .fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
</style>

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

Before

Width:  |  Height:  |  Size: 496 B

View File

@ -1,43 +0,0 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String,
})
const count = ref(0)
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="count++">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
<p>
Check out
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
>create-vue</a
>, the official Vue + Vite starter
</p>
<p>
Learn more about IDE Support for Vue in the
<a
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
target="_blank"
>Vue Docs Scaling up Guide</a
>.
</p>
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>

1
renderer/src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="vite/client" />