style(课表小组件): 下拉选中态改品牌色(#5979ea/#eef2ff);表格限高 352px 只露 7 节、超出滚动、表头 sticky 常驻
build / build (push) Successful in 41s

- .cls-item.on 由 #2d8cf0/#f0f7ff 改为 var(--color-primary, #5979ea) / var(--color-primary-weak, #eef2ff),
  与 WsToastLayer.vue 既有约定一致(CSS 变量 + 回退值);hover 改 #f4f7ff
- 表格外套 .tt-scroll:max-height 352px(表头 44 + 7×44)+ overflow-y auto + 6px 细滚动条
- th 加 position sticky / top 0 / background #fff;因 sticky + border-collapse 会丢 cell border,
  分隔线由 border-bottom 改为 box-shadow inset 0 -1px 0 #e9edf1
This commit is contained in:
chenxing
2026-10-14 09:08:06 +08:00
parent 3a7502f106
commit 27ce68a76e
+46 -20
View File
@@ -34,22 +34,25 @@
</Teleport>
<div v-if="slots.length > 0" class="table-wrap">
<table class="tt">
<thead>
<tr>
<th>节</th>
<th v-for="day in dayCols" :key="day.index">{{ day.name }}</th>
</tr>
</thead>
<tbody>
<tr v-for="slot in slots" :key="slot.slotNo">
<td class="sec">{{ cnNum(slot.slotNo) }}</td>
<td v-for="day in dayCols" :key="day.index">
<span class="sub" :title="subjectOf(slot, day.index)">{{ subjectOf(slot, day.index) }}</span>
</td>
</tr>
</tbody>
</table>
<!-- 超过 7 节(表头 44 + 7×44 = 352px)纵向滚动,表头 sticky 常驻 -->
<div class="tt-scroll">
<table class="tt">
<thead>
<tr>
<th>节</th>
<th v-for="day in dayCols" :key="day.index">{{ day.name }}</th>
</tr>
</thead>
<tbody>
<tr v-for="slot in slots" :key="slot.slotNo">
<td class="sec">{{ cnNum(slot.slotNo) }}</td>
<td v-for="day in dayCols" :key="day.index">
<span class="sub" :title="subjectOf(slot, day.index)">{{ subjectOf(slot, day.index) }}</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- 空态:模板内联 SVG,不依赖外部图片 / CSS 背景 -->
@@ -225,11 +228,11 @@ function reportHeight() {
white-space: nowrap;
&:hover {
background: #f5f8fb;
background: #f4f7ff;
}
&.on {
color: #2d8cf0;
background: #f0f7ff;
color: var(--color-primary, #5979ea);
background: var(--color-primary-weak, #eef2ff);
font-weight: 600;
}
}
@@ -240,6 +243,24 @@ function reportHeight() {
.table-wrap {
padding: 8px 8px 10px;
}
/* 最多露出 7 节课(表头 44 + 7×44 = 352),再多则纵向滚动,表头 sticky 常驻 */
.tt-scroll {
max-height: 352px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #d5dbe3 transparent;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background: #d5dbe3;
border-radius: 3px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
}
.tt {
width: 100%;
border-collapse: collapse;
@@ -255,7 +276,12 @@ function reportHeight() {
// 否则表头文字按基线对齐、偏上,视觉上像"贴住卡片 header"
vertical-align: middle;
border: 0;
border-bottom: 1px solid #e9edf1;
// sticky + border-collapse 时 cell 的 border 会随滚动丢失 ⇒ 用 inset box-shadow 画分隔线
box-shadow: inset 0 -1px 0 #e9edf1;
position: sticky;
top: 0;
z-index: 1;
background: #fff;
}
th:first-child,
td:first-child {