feat: 更新代码
This commit is contained in:
28
src/App.vue
28
src/App.vue
@@ -1,33 +1,25 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted } from 'vue'
|
import { onMounted } from "vue";
|
||||||
import HelloWorld from './components/HelloWorld.vue'
|
import HelloWorld from "./components/HelloWorld.vue";
|
||||||
import { useMainStore } from './store'
|
import { useMainStore } from "./store";
|
||||||
|
|
||||||
const store = useMainStore()
|
const store = useMainStore();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log('Vue应用已挂载,路由和Pinia已集成')
|
console.log("Vue应用已挂载,路由和Pinia已集成");
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<HelloWorld />
|
||||||
<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" />
|
|
||||||
|
|
||||||
<!-- Pinia 状态管理示例 -->
|
<!-- 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>
|
<h3>计数器: {{ store.count }}</h3>
|
||||||
<button @click="store.increment()">+1</button>
|
<button @click="store.increment()">+1</button>
|
||||||
<button @click="store.decrement()">-1</button>
|
<button @click="store.decrement()">-1</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 路由视图 -->
|
<!-- 路由视图 -->
|
||||||
<router-view />
|
<router-view />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,43 +1,53 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
// import TheWelcome from '../components/TheWelcome.vue'
|
||||||
|
import { onMounted } from "vue";
|
||||||
defineProps({
|
onMounted(async () => {
|
||||||
msg: String,
|
let res = await window.myApi.handleSend("liaoruiruirurirui");
|
||||||
})
|
console.log(res);
|
||||||
|
});
|
||||||
const count = ref(0)
|
const toMin = () => {
|
||||||
|
window.myApi.windowMin();
|
||||||
|
};
|
||||||
|
const toBig = () => {
|
||||||
|
window.myApi.windowMax();
|
||||||
|
};
|
||||||
|
const toClose = () => {
|
||||||
|
window.myApi.windowClose();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1>{{ msg }}</h1>
|
<main>
|
||||||
|
<div class="hearder">
|
||||||
<div class="card">
|
<span @click="toMin">最小化</span>
|
||||||
<button type="button" @click="count++">count is {{ count }}</button>
|
<span @click="toBig">最大化</span>
|
||||||
<p>
|
<span @click="toClose">关闭</span>
|
||||||
Edit
|
</div>
|
||||||
<code>components/HelloWorld.vue</code> to test HMR
|
<div class="main">主要内容</div>
|
||||||
</p>
|
<!-- <TheWelcome /> -->
|
||||||
</div>
|
</main>
|
||||||
|
|
||||||
<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>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.read-the-docs {
|
.hearder {
|
||||||
color: #888;
|
-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>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user