style: update border-radius and padding values across components

- standardize border-radius from 8px to 6px for consistent styling
- adjust padding values from 1rem to 0.75rem for better visual hierarchy
- remove redundant overflow-y properties for cleaner code
This commit is contained in:
sanbuphy
2026-02-14 20:23:34 +08:00
parent 81e4284b87
commit d35211071a
373 changed files with 3441 additions and 5629 deletions
@@ -1,44 +1,48 @@
<!--
DomManipulator.vue
DOM 操作速体验输入标题+切换高亮类直观看到文本和样式变化
-->
<template>
<div class="dom-demo">
<div class="demo-header">
<span class="icon">🎯</span>
<span class="title">DOM 操作</span>
<span class="subtitle">网页内容的动态修改通俗说用代码改页面</span>
<span class="subtitle">用代码动态修改页面</span>
</div>
<div class="demo-content">
<div class="controls">
<div class="field">
<label>改个标题</label>
<input v-model="title" placeholder="输入新标题" />
<div class="main-area">
<div class="left-panel">
<div class="controls">
<div class="field">
<label>修改标题</label>
<input v-model="title" placeholder="输入新标题" />
</div>
<label class="checkbox">
<input type="checkbox" v-model="highlight" />
高亮模式
</label>
</div>
<div class="field checkbox">
<label><input type="checkbox" v-model="highlight" /> 高亮模式 (class="highlight")</label>
<div class="card" :class="{ highlight }">
<h2>{{ title }}</h2>
<p>这里是段落说明勾选高亮看看变化</p>
<button @click="toggleText">{{ buttonText }}</button>
</div>
</div>
<div class="card" :class="{ highlight }">
<h2 id="hero">{{ title }}</h2>
<p id="desc">这里是段落说明勾选高亮看看变化</p>
<button @click="toggleText">{{ buttonText }}</button>
<div class="right-panel">
<div class="code-block">
<div class="code-title">JavaScript</div>
<div class="code-content">
<div class="line">// 改内容</div>
<div class="line">titleEl.textContent = '{{ title }}'</div>
<div class="line"></div>
<div class="line">// 切换 class</div>
<div class="line">card.classList.toggle('highlight', {{ highlight }})</div>
</div>
</div>
</div>
<pre class="code"><code>// JS 改内容
const titleEl = document.getElementById('hero')
titleEl.textContent = '{{ title }}'
// JS 切 class
const card = document.querySelector('.card')
card.classList.toggle('highlight', {{ highlight }})</code></pre>
</div>
<div class="info-box">
<span class="icon">💡</span>
<strong>核心思想</strong>DOM 是网页的"乐高积木"JavaScript 可以随时添加删除修改这些积木
<strong>核心思想</strong>DOM 是网页的"乐高积木"JS 可以随时添加删除修改这些积木
</div>
</div>
</template>
@@ -58,12 +62,10 @@ const toggleText = () => {
<style scoped>
.dom-demo {
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
border-radius: 6px;
background: var(--vp-c-bg-soft);
padding: 1rem;
margin: 1rem 0;
max-height: 600px;
overflow-y: auto;
padding: 0.75rem;
margin: 0.5rem 0;
}
.demo-header {
@@ -73,127 +75,146 @@ const toggleText = () => {
margin-bottom: 0.75rem;
}
.demo-header .icon {
font-size: 1.25rem;
}
.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; }
.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;
}
.demo-content {
margin-bottom: 0.5rem;
}
.controls {
.main-area {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 0.5rem;
margin-bottom: 1rem;
grid-template-columns: 1fr 1fr;
gap: 1rem;
margin-bottom: 0.75rem;
}
.field {
background: var(--vp-c-bg);
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
padding: 0.75rem;
@media (max-width: 640px) {
.main-area { grid-template-columns: 1fr; }
}
.left-panel {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.controls {
display: flex;
gap: 0.5rem;
align-items: center;
flex-wrap: wrap;
}
.field {
display: flex;
align-items: center;
gap: 0.4rem;
background: var(--vp-c-bg);
border: 1px solid var(--vp-c-divider);
border-radius: 6px;
padding: 0.4rem 0.6rem;
}
.field label {
font-size: 0.8rem;
font-weight: 600;
color: var(--vp-c-text-2);
}
.field input[type='text'] {
border: none;
background: transparent;
color: var(--vp-c-text-1);
font-size: 0.85rem;
outline: none;
width: 120px;
}
.checkbox {
flex-direction: row;
display: flex;
align-items: center;
gap: 0.5rem;
}
input[type='text'] {
width: 100%;
padding: 0.5rem;
border: 1px solid var(--vp-c-divider);
border-radius: 4px;
background: var(--vp-c-bg);
gap: 0.4rem;
font-size: 0.8rem;
color: var(--vp-c-text-1);
cursor: pointer;
}
input[type='text']:focus {
outline: none;
border-color: var(--vp-c-brand);
}
input[type='checkbox'] {
.checkbox input {
accent-color: var(--vp-c-brand);
}
.card {
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
padding: 1rem;
border-radius: 6px;
padding: 0.75rem;
background: var(--vp-c-bg);
transition: all 0.2s;
margin-bottom: 1rem;
}
.card.highlight {
border-color: var(--vp-c-warning);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
background: var(--vp-c-bg-soft);
}
.card h2 {
margin: 0 0 0.5rem 0;
margin: 0 0 0.25rem 0;
color: var(--vp-c-text-1);
font-size: 0.95rem;
}
.card p {
margin: 0 0 0.75rem 0;
margin: 0 0 0.5rem 0;
color: var(--vp-c-text-2);
font-size: 0.9rem;
font-size: 0.8rem;
}
.card button {
background: var(--vp-c-brand);
color: white;
border: none;
border-radius: 6px;
padding: 0.5rem 1rem;
border-radius: 4px;
padding: 0.35rem 0.75rem;
cursor: pointer;
font-size: 0.85rem;
font-size: 0.8rem;
transition: opacity 0.2s;
}
.card button:hover {
opacity: 0.9;
.card button:hover { opacity: 0.9; }
.right-panel {
display: flex;
flex-direction: column;
}
.code {
background: var(--vp-c-bg-alt);
color: var(--vp-c-text-1);
border-radius: 8px;
padding: 0.75rem;
font-family: var(--vp-font-family-mono);
font-size: 0.75rem;
overflow-x: auto;
line-height: 1.6;
.code-block {
background: var(--vp-c-bg);
border: 1px solid var(--vp-c-divider);
border-radius: 6px;
padding: 0.6rem;
height: 100%;
}
.code-title {
font-size: 0.75rem;
font-weight: 600;
color: var(--vp-c-text-2);
margin-bottom: 0.4rem;
}
.code-content {
background: #0b1221;
color: #e5e7eb;
border-radius: 4px;
padding: 0.5rem;
font-family: var(--vp-font-family-mono);
font-size: 0.7rem;
line-height: 1.5;
}
.line { white-space: pre; }
.info-box {
background: var(--vp-c-bg-alt);
padding: 0.75rem;
padding: 0.6rem;
border-radius: 6px;
font-size: 0.85rem;
color: var(--vp-c-text-2);
@@ -201,11 +222,6 @@ input[type='checkbox'] {
gap: 0.25rem;
}
.info-box .icon {
flex-shrink: 0;
}
.info-box strong {
color: var(--vp-c-text-1);
}
.info-box .icon { flex-shrink: 0; }
.info-box strong { color: var(--vp-c-text-1); }
</style>