first
This commit is contained in:
84
src/views/Essentials.vue
Normal file
84
src/views/Essentials.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<main class="content">
|
||||
<header class="content-header">
|
||||
<h1>装机必备</h1>
|
||||
<button @click="installAll" class="primary-btn">一键安装全部</button>
|
||||
</header>
|
||||
|
||||
<div class="software-grid">
|
||||
<SoftwareCard
|
||||
v-for="item in store.essentials"
|
||||
:key="item.id"
|
||||
:software="item"
|
||||
action-label="安装"
|
||||
@install="store.install"
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import SoftwareCard from '../components/SoftwareCard.vue';
|
||||
import { useSoftwareStore } from '../store/software';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const store = useSoftwareStore();
|
||||
|
||||
onMounted(() => {
|
||||
store.fetchEssentials();
|
||||
store.initListener();
|
||||
});
|
||||
|
||||
const installAll = () => {
|
||||
store.essentials.forEach(s => {
|
||||
if (s.status === 'idle') {
|
||||
store.install(s.id);
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 40px 60px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.content-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.content-header h1 {
|
||||
font-size: 34px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
border-radius: var(--radius-btn);
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
cursor: pointer;
|
||||
box-shadow: var(--btn-shadow);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.primary-btn:hover {
|
||||
background-color: var(--primary-hover);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.software-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 24px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user