2026-02-06 03:34:50 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="build-pipeline-demo">
|
2026-02-13 00:36:06 +08:00
|
|
|
|
<div class="demo-header">
|
|
|
|
|
|
<span class="icon">🏭</span>
|
|
|
|
|
|
<span class="title">构建流水线</span>
|
|
|
|
|
|
<span class="subtitle">从源代码到产物的完整旅程</span>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
<div class="pipeline">
|
|
|
|
|
|
<div v-for="(stage, i) in stages" :key="stage.id" class="stage">
|
|
|
|
|
|
<div class="stage-icon">{{ stage.icon }}</div>
|
|
|
|
|
|
<div class="stage-name">{{ stage.name }}</div>
|
|
|
|
|
|
<div class="stage-desc">{{ stage.desc }}</div>
|
|
|
|
|
|
<div v-if="i < stages.length - 1" class="arrow">→</div>
|
2026-02-06 03:34:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="info-box">
|
2026-02-13 00:36:06 +08:00
|
|
|
|
<span class="icon">💡</span>
|
|
|
|
|
|
<strong>流水线思想:</strong>就像工厂流水线一样,代码经过一道道工序,最终变成可以在浏览器运行的产物。每个阶段各司其职,环环相扣。
|
2026-02-06 03:34:50 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-02-13 00:36:06 +08:00
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
|
|
|
|
const stages = ref([
|
|
|
|
|
|
{ id: 1, icon: '🔍', name: '代码检查', desc: 'ESLint/TSC' },
|
|
|
|
|
|
{ id: 2, icon: '⚙️', name: '代码转换', desc: 'Babel/SWC' },
|
|
|
|
|
|
{ id: 3, icon: '📦', name: '依赖解析', desc: '构建依赖图' },
|
|
|
|
|
|
{ id: 4, icon: '📚', name: '模块打包', desc: 'Webpack/Rollup' },
|
|
|
|
|
|
{ id: 5, icon: '✨', name: '代码优化', desc: '压缩/TreeShake' }
|
|
|
|
|
|
])
|
2026-02-06 03:34:50 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.build-pipeline-demo {
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 8px;
|
2026-02-13 00:36:06 +08:00
|
|
|
|
background: var(--vp-c-bg-soft);
|
2026-02-06 03:34:50 +08:00
|
|
|
|
padding: 1rem;
|
|
|
|
|
|
margin: 1rem 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
.demo-header {
|
2026-02-06 03:34:50 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 0.5rem;
|
2026-02-13 00:36:06 +08:00
|
|
|
|
margin-bottom: 1rem;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
.demo-header .icon { font-size: 1.25rem; }
|
|
|
|
|
|
.demo-header .title { font-weight: bold; font-size: 1rem; }
|
|
|
|
|
|
.demo-header .subtitle { color: var(--vp-c-text-2); font-size: 0.85rem; margin-left: 0.5rem; }
|
2026-02-06 03:34:50 +08:00
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
.pipeline {
|
2026-02-06 03:34:50 +08:00
|
|
|
|
display: flex;
|
2026-02-13 00:36:06 +08:00
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
gap: 0.25rem;
|
|
|
|
|
|
padding: 0.75rem;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
background: var(--vp-c-bg);
|
2026-02-13 00:36:06 +08:00
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
overflow-x: auto;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
.stage {
|
2026-02-06 03:34:50 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
2026-02-13 00:36:06 +08:00
|
|
|
|
min-width: 80px;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.stage-icon {
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
border-radius: 8px;
|
2026-02-13 00:36:06 +08:00
|
|
|
|
background: var(--vp-c-brand);
|
2026-02-06 03:34:50 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
font-size: 1.25rem;
|
2026-02-13 00:36:06 +08:00
|
|
|
|
margin-bottom: 0.5rem;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
.stage-name {
|
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
|
font-weight: 500;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
color: var(--vp-c-text-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
.stage-desc {
|
|
|
|
|
|
font-size: 0.7rem;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
color: var(--vp-c-text-3);
|
2026-02-13 00:36:06 +08:00
|
|
|
|
margin-top: 0.2rem;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
.arrow {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
right: -12px;
|
|
|
|
|
|
top: 16px;
|
|
|
|
|
|
color: var(--vp-c-text-3);
|
|
|
|
|
|
font-size: 1rem;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.info-box {
|
2026-02-13 00:36:06 +08:00
|
|
|
|
background: var(--vp-c-bg-alt);
|
2026-02-06 03:34:50 +08:00
|
|
|
|
padding: 0.75rem;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
font-size: 0.85rem;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
2026-02-13 00:36:06 +08:00
|
|
|
|
margin-top: 0.75rem;
|
2026-02-06 03:34:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 00:36:06 +08:00
|
|
|
|
.info-box .icon { margin-right: 0.25rem; }
|
2026-02-06 03:34:50 +08:00
|
|
|
|
</style>
|