feat: 更新代码

This commit is contained in:
duanshuwen
2025-09-22 21:04:17 +08:00
parent 065263c15f
commit 3c4f14be7f
2 changed files with 55 additions and 53 deletions

View File

@@ -1,33 +1,25 @@
<script setup>
import { onMounted } from 'vue'
import HelloWorld from './components/HelloWorld.vue'
import { useMainStore } from './store'
import { onMounted } from "vue";
import HelloWorld from "./components/HelloWorld.vue";
import { useMainStore } from "./store";
const store = useMainStore()
const store = useMainStore();
onMounted(() => {
console.log('Vue应用已挂载路由和Pinia已集成')
})
console.log("Vue应用已挂载路由和Pinia已集成");
});
</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>
<HelloWorld msg="Vite + Vue" />
<HelloWorld />
<!-- Pinia 状态管理示例 -->
<div style="margin: 20px; padding: 20px; border: 1px solid #ccc;">
<div style="margin: 20px; padding: 20px; border: 1px solid #ccc">
<h3>计数器: {{ store.count }}</h3>
<button @click="store.increment()">+1</button>
<button @click="store.decrement()">-1</button>
</div>
<!-- 路由视图 -->
<router-view />
</template>

View File

@@ -1,43 +1,53 @@
<script setup>
import { ref } from 'vue'
defineProps({
msg: String,
})
const count = ref(0)
<script setup lang="ts">
// import TheWelcome from '../components/TheWelcome.vue'
import { onMounted } from "vue";
onMounted(async () => {
let res = await window.myApi.handleSend("liaoruiruirurirui");
console.log(res);
});
const toMin = () => {
window.myApi.windowMin();
};
const toBig = () => {
window.myApi.windowMax();
};
const toClose = () => {
window.myApi.windowClose();
};
</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>
<main>
<div class="hearder">
<span @click="toMin">最小化</span>
<span @click="toBig">最大化</span>
<span @click="toClose">关闭</span>
</div>
<div class="main">主要内容</div>
<!-- <TheWelcome /> -->
</main>
</template>
<style scoped>
.read-the-docs {
color: #888;
.hearder {
-webkit-app-region: drag;
background-color: #ccc;
height: 40px;
width: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
}
.hearder span {
margin: 0 16px;
border: 1px solid rgb(35, 34, 34);
cursor: pointer;
-webkit-app-region: no-drag;
}
.main {
height: calc(100vh - 40px);
display: flex;
align-items: center;
justify-content: center;
}
</style>