2026-01-16 19:10:21 +08:00
|
|
|
|
<template>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
<div class="url-parser-demo custom-demo-base">
|
|
|
|
|
|
<div class="demo-label">URL 解析 ── 把人类文字翻译成结构化信息</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="demo-panel url-panel">
|
|
|
|
|
|
<!-- url block -->
|
|
|
|
|
|
<div class="url-layout">
|
|
|
|
|
|
<span
|
|
|
|
|
|
class="url-part protocol"
|
|
|
|
|
|
:class="{ active: activePart === 'protocol' }"
|
|
|
|
|
|
@mouseenter="activePart = 'protocol'"
|
|
|
|
|
|
@mouseleave="activePart = null"
|
|
|
|
|
|
>https://</span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
class="url-part host"
|
|
|
|
|
|
:class="{ active: activePart === 'host' }"
|
|
|
|
|
|
@mouseenter="activePart = 'host'"
|
|
|
|
|
|
@mouseleave="activePart = null"
|
|
|
|
|
|
>www.google.com</span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
class="url-part path"
|
|
|
|
|
|
:class="{ active: activePart === 'path' }"
|
|
|
|
|
|
@mouseenter="activePart = 'path'"
|
|
|
|
|
|
@mouseleave="activePart = null"
|
|
|
|
|
|
>/search</span>
|
2026-01-18 10:24:35 +08:00
|
|
|
|
</div>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
|
|
|
|
|
|
<div class="info-blocks">
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="info-card protocol-card"
|
|
|
|
|
|
:class="{ active: activePart === 'protocol' }"
|
|
|
|
|
|
@mouseenter="activePart = 'protocol'"
|
|
|
|
|
|
@mouseleave="activePart = null"
|
2026-02-18 17:38:10 +08:00
|
|
|
|
>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
<div class="card-title">🚛 交通方式 (协议 Protocol)</div>
|
|
|
|
|
|
<div class="card-desc">代表你要求坐安全级别最高的"运钞车"(加密通信HTTPS)。如果是 HTTP,就是老式敞篷车,沿途都会被看见。</div>
|
2026-01-18 10:24:35 +08:00
|
|
|
|
</div>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="info-card host-card"
|
|
|
|
|
|
:class="{ active: activePart === 'host' }"
|
|
|
|
|
|
@mouseenter="activePart = 'host'"
|
|
|
|
|
|
@mouseleave="activePart = null"
|
2026-02-18 17:38:10 +08:00
|
|
|
|
>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
<div class="card-title">🏢 店铺名 (主机名 Host)</div>
|
|
|
|
|
|
<div class="card-desc">这就是你要去哪家店,也是服务器的域名,后续浏览器需要把它翻译成网络世界认的数字 IP。</div>
|
|
|
|
|
|
</div>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="info-card path-card"
|
|
|
|
|
|
:class="{ active: activePart === 'path' }"
|
|
|
|
|
|
@mouseenter="activePart = 'path'"
|
|
|
|
|
|
@mouseleave="activePart = null"
|
2026-01-16 19:10:21 +08:00
|
|
|
|
>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
<div class="card-title">📍 具体货架 (路径 Path)</div>
|
|
|
|
|
|
<div class="card-desc">进了店门之后,你要去哪个房间拿具体的哪件商品或执行具体的某个动作。</div>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
<div class="demo-status">悬停查看每个部分的职责</div>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
import { ref } from 'vue'
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
const activePart = ref(null)
|
2026-01-16 19:10:21 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.custom-demo-base {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-24 08:34:53 +08:00
|
|
|
|
border-radius: 8px;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
background: var(--vp-c-bg-soft);
|
2026-02-24 08:34:53 +08:00
|
|
|
|
padding: 1rem 1.2rem;
|
|
|
|
|
|
margin: 1rem 0;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.demo-label {
|
|
|
|
|
|
font-size: 0.78rem;
|
|
|
|
|
|
font-weight: bold;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
color: var(--vp-c-text-2);
|
2026-02-24 08:34:53 +08:00
|
|
|
|
margin-bottom: 0.75rem;
|
|
|
|
|
|
letter-spacing: 0.2px;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.demo-panel {
|
2026-01-18 10:24:35 +08:00
|
|
|
|
display: flex;
|
2026-02-24 08:34:53 +08:00
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 1.5rem;
|
|
|
|
|
|
padding: 1.5rem;
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
background: var(--vp-c-bg);
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.demo-status {
|
|
|
|
|
|
margin-top: 0.75rem;
|
|
|
|
|
|
font-size: 0.78rem;
|
|
|
|
|
|
color: var(--vp-c-text-3);
|
|
|
|
|
|
text-align: center;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.url-layout {
|
|
|
|
|
|
font-size: 1.8rem;
|
|
|
|
|
|
font-weight: bold;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
display: flex;
|
2026-02-24 08:34:53 +08:00
|
|
|
|
justify-content: center;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
align-items: center;
|
2026-02-24 08:34:53 +08:00
|
|
|
|
gap: 0.2rem;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
flex-wrap: wrap;
|
2026-02-24 08:34:53 +08:00
|
|
|
|
font-family: var(--vp-font-family-mono);
|
|
|
|
|
|
padding: 1rem;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
background: var(--vp-c-bg-alt);
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-18 10:24:35 +08:00
|
|
|
|
.url-part {
|
2026-02-24 08:34:53 +08:00
|
|
|
|
padding: 0.3rem 0.6rem;
|
|
|
|
|
|
border-radius: 6px;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
cursor: pointer;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
transition: all 0.2s;
|
2026-02-24 08:34:53 +08:00
|
|
|
|
border: 2px solid transparent;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.url-part.protocol { color: var(--vp-c-danger-1, #ef4444); }
|
|
|
|
|
|
.url-part.protocol.active { background: var(--vp-c-danger-soft, #fef2f2); border-color: var(--vp-c-danger-1, #ef4444); transform: scale(1.05); }
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.url-part.host { color: var(--vp-c-brand-1, #3b82f6); }
|
|
|
|
|
|
.url-part.host.active { background: var(--vp-c-brand-soft, #eff6ff); border-color: var(--vp-c-brand-1, #3b82f6); transform: scale(1.05); }
|
2026-01-18 10:24:35 +08:00
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.url-part.path { color: var(--vp-c-success-1, #10b981); }
|
|
|
|
|
|
.url-part.path.active { background: var(--vp-c-success-soft, #ecfdf5); border-color: var(--vp-c-success-1, #10b981); transform: scale(1.05); }
|
2026-01-18 10:24:35 +08:00
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.info-blocks {
|
2026-01-18 10:24:35 +08:00
|
|
|
|
display: grid;
|
2026-02-24 08:34:53 +08:00
|
|
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
2026-01-16 19:10:21 +08:00
|
|
|
|
gap: 1rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.info-card {
|
|
|
|
|
|
padding: 1.2rem;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
border: 2px solid transparent;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
background: var(--vp-c-bg-alt);
|
2026-01-16 19:10:21 +08:00
|
|
|
|
transition: all 0.2s;
|
2026-02-24 08:34:53 +08:00
|
|
|
|
cursor: pointer;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.info-card:hover, .info-card.active {
|
2026-01-18 10:24:35 +08:00
|
|
|
|
transform: translateY(-4px);
|
2026-02-24 08:34:53 +08:00
|
|
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.protocol-card.active { border-color: var(--vp-c-danger-1, #ef4444); background: var(--vp-c-danger-soft, #fef2f2); }
|
|
|
|
|
|
.host-card.active { border-color: var(--vp-c-brand-1, #3b82f6); background: var(--vp-c-brand-soft, #eff6ff); }
|
|
|
|
|
|
.path-card.active { border-color: var(--vp-c-success-1, #10b981); background: var(--vp-c-success-soft, #ecfdf5); }
|
2026-01-18 10:24:35 +08:00
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.card-title {
|
|
|
|
|
|
font-size: 0.95rem;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
font-weight: bold;
|
2026-02-24 08:34:53 +08:00
|
|
|
|
margin-bottom: 0.6rem;
|
2026-01-18 10:24:35 +08:00
|
|
|
|
color: var(--vp-c-text-1);
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.protocol-card.active .card-title { color: var(--vp-c-danger-1, #ef4444); }
|
|
|
|
|
|
.host-card.active .card-title { color: var(--vp-c-brand-1, #3b82f6); }
|
|
|
|
|
|
.path-card.active .card-title { color: var(--vp-c-success-1, #10b981); }
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
.card-desc {
|
|
|
|
|
|
font-size: 0.85rem;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
color: var(--vp-c-text-2);
|
2026-02-24 08:34:53 +08:00
|
|
|
|
line-height: 1.6;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-24 08:34:53 +08:00
|
|
|
|
@media (max-width: 640px) {
|
|
|
|
|
|
.url-layout { font-size: 1.2rem; }
|
|
|
|
|
|
.info-blocks { grid-template-columns: 1fr; }
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|