2026-02-14 01:00:26 +08:00
|
|
|
|
<!--
|
|
|
|
|
|
DeploymentBuildDemo.vue
|
|
|
|
|
|
构建过程演示:原材料变成品(简化版)
|
|
|
|
|
|
-->
|
2026-02-13 22:10:03 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="deployment-build">
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<div class="header">
|
|
|
|
|
|
<span class="icon">📦</span>
|
|
|
|
|
|
<span class="title">代码构建</span>
|
2026-02-13 22:10:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<div class="content">
|
|
|
|
|
|
<div class="flow">
|
|
|
|
|
|
<div class="step" :class="{ done: buildProgress >= 25 }">
|
|
|
|
|
|
<span class="num">1</span>
|
|
|
|
|
|
<span class="text">解析依赖</span>
|
2026-02-13 22:10:03 +08:00
|
|
|
|
</div>
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<span class="arrow">→</span>
|
|
|
|
|
|
<div class="step" :class="{ done: buildProgress >= 50 }">
|
|
|
|
|
|
<span class="num">2</span>
|
|
|
|
|
|
<span class="text">编译转换</span>
|
2026-02-13 22:10:03 +08:00
|
|
|
|
</div>
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<span class="arrow">→</span>
|
|
|
|
|
|
<div class="step" :class="{ done: buildProgress >= 75 }">
|
|
|
|
|
|
<span class="num">3</span>
|
|
|
|
|
|
<span class="text">打包压缩</span>
|
2026-02-13 22:10:03 +08:00
|
|
|
|
</div>
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<span class="arrow">→</span>
|
|
|
|
|
|
<div class="step" :class="{ done: buildProgress >= 100 }">
|
|
|
|
|
|
<span class="num">4</span>
|
|
|
|
|
|
<span class="text">完成</span>
|
2026-02-13 22:10:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<div class="progress">
|
|
|
|
|
|
<div class="bar">
|
|
|
|
|
|
<div class="fill" :style="{ width: `${buildProgress}%` }"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="percent">{{ buildProgress }}%</div>
|
2026-02-13 22:10:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<button @click="startBuild" class="build-btn" :disabled="building">
|
|
|
|
|
|
{{ building ? '构建中...' : '▶ 开始构建' }}
|
|
|
|
|
|
</button>
|
2026-02-13 22:10:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref } from 'vue'
|
2026-02-13 22:10:03 +08:00
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
const building = ref(false)
|
|
|
|
|
|
const buildProgress = ref(0)
|
2026-02-13 22:10:03 +08:00
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
const startBuild = () => {
|
|
|
|
|
|
if (building.value) return
|
|
|
|
|
|
building.value = true
|
|
|
|
|
|
buildProgress.value = 0
|
2026-02-13 22:10:03 +08:00
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
const interval = setInterval(() => {
|
|
|
|
|
|
buildProgress.value += 5
|
|
|
|
|
|
if (buildProgress.value >= 100) {
|
|
|
|
|
|
clearInterval(interval)
|
|
|
|
|
|
building.value = false
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
buildProgress.value = 0
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 150)
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
2026-02-14 01:00:26 +08:00
|
|
|
|
</script>
|
2026-02-13 22:10:03 +08:00
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
<style scoped>
|
|
|
|
|
|
.deployment-build {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-14 20:23:34 +08:00
|
|
|
|
border-radius: 6px;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
background: var(--vp-c-bg-soft);
|
|
|
|
|
|
padding: 0.75rem;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
margin: 0.5rem 0;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.header {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
|
margin-bottom: 0.75rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.header .icon {
|
|
|
|
|
|
font-size: 1.25rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.header .title {
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
|
color: var(--vp-c-text-1);
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.content {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
gap: 0.75rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.flow {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
|
padding: 0.75rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
background: var(--vp-c-bg);
|
2026-02-14 20:23:34 +08:00
|
|
|
|
border-radius: 6px;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
overflow-x: auto;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.step {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
gap: 0.25rem;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
padding: 0.5rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
background: var(--vp-c-bg-soft);
|
|
|
|
|
|
border-radius: 6px;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
min-width: 60px;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.step.done {
|
|
|
|
|
|
background: var(--vp-c-brand-dimm);
|
|
|
|
|
|
color: var(--vp-c-brand-delta);
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.step .num {
|
|
|
|
|
|
font-weight: 700;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.arrow {
|
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
|
color: var(--vp-c-text-3);
|
|
|
|
|
|
flex-shrink: 0;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.progress {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
gap: 0.75rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.bar {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
height: 8px;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
background: var(--vp-c-bg-alt);
|
2026-02-14 01:00:26 +08:00
|
|
|
|
border-radius: 4px;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.fill {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
height: 100%;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
background: var(--vp-c-brand);
|
|
|
|
|
|
transition: width 0.3s ease;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.percent {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
font-weight: 700;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
font-size: 0.9rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
color: var(--vp-c-brand);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.build-btn {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 0.75rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
background: var(--vp-c-brand);
|
|
|
|
|
|
color: white;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
border: none;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
border-radius: 6px;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
font-size: 0.9rem;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
cursor: pointer;
|
2026-02-14 01:00:26 +08:00
|
|
|
|
transition: background 0.2s ease;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.build-btn:hover:not(:disabled) {
|
2026-02-13 22:10:03 +08:00
|
|
|
|
background: var(--vp-c-brand-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 01:00:26 +08:00
|
|
|
|
.build-btn:disabled {
|
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
|
cursor: not-allowed;
|
2026-02-13 22:10:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|