Regression / regression (push) Canceled after 0s
## 品牌标识(本次会话) 起因:品牌此前没有任何图形标识 —— 唯一 favicon 是内联 data-URI 里的字母「A」, 那是 v2.0.0「Aurora Admin → Kole UI」改名漏掉的一处(PC 顶栏也是「A」, 移动端站已是「K」;移动端文档站则完全没有 favicon)。 - 几何:24 网格三个互不接触的笔画(竖 + 两斜),圆头描边; 描边 2.25 → 16px 标签页尺寸下正好 1.5px = 规范原文「描边1.5px」 - 取色分两套(刻意):favicon 硬编码品牌蓝/白(渲染在浏览器标签栏,不继承 kole-dark); 顶栏标记走 currentColor(实测暗色下自动转 rgb(20,22,28)) - 新增 theme-color 双条(light #FFFFFF / dark #1C1F26,取 --kole-color-card-bg) - 修 site/app.js hero 标语 KOLE ADMIN → KOLE UI(改名变形残留) - 移动端 7 个模板补 favicon(此前计数 0) 验收:门禁 9 条全 OK(site-routing/site-routes/mobile-docs/mobile-site/isolation/ theme/nav/i18n/icons);PC 回归 1464/1464 · 移动端 807/807,各连跑 8 次一致; 两端 favicon 405 字节逐字节一致;PC 站控制台错误 1→0。 ## 并行会话成果(本次一并入库) - 图标系统:2576 图标(TDesign/Element Plus,MIT)+ 11 端注入 + 5 个构建门禁工具 + IconPreview 预览页 + ICON-SPEC.md 冻结规格 - 移动端平台:47 组件 × 6 端 + 文档站 53 页 + 隔离门禁 - PC 组件:103 个大后台组件 / 组件11 批次 - uni-app:PC 端试点 + 移动端端实现 + 真实编译验证 ## 工程 - .gitignore 补 .scratch/ 与 .zcode-preexisting-*.txt(会话中间产物,实测 9.1MB,不入库) - CHANGELOG 补品牌标识条目 - ROADMAP 登 S8-P4(品牌标识任务包 + og:image/apple-touch-icon 未做部分)
178 lines
5.4 KiB
Vue
178 lines
5.4 KiB
Vue
<template>
|
||
<view class="kole-m-stepper" :class="stepperClass" role="group" :aria-label="label || ''">
|
||
<view
|
||
class="kole-m-stepper__minus"
|
||
:role="disabled || atMin ? '' : 'button'"
|
||
:aria-disabled="disabled || atMin ? 'true' : 'false'"
|
||
aria-label="减少"
|
||
@tap="minus"
|
||
>
|
||
<text>−</text>
|
||
</view>
|
||
<input
|
||
v-if="editable"
|
||
class="kole-m-stepper__value-input"
|
||
type="number"
|
||
:value="String(value)"
|
||
:disabled="disabled"
|
||
:aria-label="label || '数量'"
|
||
@input="onInput"
|
||
/>
|
||
<text
|
||
v-else
|
||
class="kole-m-stepper__value"
|
||
role="spinbutton"
|
||
:aria-valuenow="value"
|
||
:aria-valuemin="min"
|
||
:aria-valuemax="max"
|
||
>{{ value }}</text
|
||
>
|
||
<slot></slot>
|
||
<view
|
||
class="kole-m-stepper__plus"
|
||
:role="disabled || atMax ? '' : 'button'"
|
||
:aria-disabled="disabled || atMax ? 'true' : 'false'"
|
||
aria-label="增加"
|
||
@tap="plus"
|
||
>
|
||
<text>+</text>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
/* uni-app 端 · 步进器(移动端)— 规格 §30
|
||
跨端差异:
|
||
① 加减用 view + role="button"(小程序没有可聚焦的原生 button 语义),点击用 @tap;
|
||
② 到边界时不用原生 disabled(view 没有),改为 aria-disabled + is-disabled 类,
|
||
代码里自己拦住点击 —— 按钮**留在原位灰**,不隐藏;
|
||
③ 值区用 <text>;editable 时用 uni 的 <input type="number">,
|
||
事件对象是 { detail: { value } },没有 DOM event.target。
|
||
尺寸用 rpx:88rpx = 375pt 下的 44px 触控最小边长。 */
|
||
import { computed } from 'vue';
|
||
|
||
const props = defineProps({
|
||
value: { type: Number, default: 1 },
|
||
min: { type: Number, default: 1 },
|
||
max: { type: Number, default: 99 },
|
||
step: { type: Number, default: 1 },
|
||
size: { type: String, default: 'default' },
|
||
round: { type: Boolean, default: false },
|
||
editable: { type: Boolean, default: false },
|
||
disabled: { type: Boolean, default: false },
|
||
label: { type: String, default: '' }
|
||
});
|
||
const emit = defineEmits(['change', 'input']);
|
||
|
||
const atMin = computed(() => props.value <= props.min);
|
||
const atMax = computed(() => props.value >= props.max);
|
||
|
||
const stepperClass = computed(() => [
|
||
props.size === 'small' ? 'kole-m-stepper--small' : '',
|
||
props.round ? 'kole-m-stepper--round' : '',
|
||
props.disabled ? 'is-disabled' : '',
|
||
props.disabled || atMin.value ? 'is-minus-disabled' : '',
|
||
props.disabled || atMax.value ? 'is-plus-disabled' : ''
|
||
].filter(Boolean));
|
||
|
||
function clamp(next) {
|
||
return Math.max(props.min, Math.min(props.max, next));
|
||
}
|
||
|
||
function minus() {
|
||
if (props.disabled || atMin.value) return;
|
||
emit('change', clamp(props.value - props.step));
|
||
}
|
||
|
||
function plus() {
|
||
if (props.disabled || atMax.value) return;
|
||
emit('change', clamp(props.value + props.step));
|
||
}
|
||
|
||
/* uni 的 <input> 事件对象为 { detail: { value } },无 DOM event.target */
|
||
function onInput(e) {
|
||
if (props.disabled) return;
|
||
emit('input', e && e.detail ? e.detail.value : '');
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.kole-m-stepper {
|
||
--kole-m-stepper-height: 88rpx; /* 控件高(88rpx = 44px,触控最小边长) */
|
||
--kole-m-stepper-btn: 88rpx; /* 单个加减按钮边长(44px 见方) */
|
||
--kole-m-stepper-radius: 8rpx;
|
||
--kole-m-touch-target: 88rpx;
|
||
--kole-m-font-size-title: 34rpx;
|
||
--kole-m-font-size-label: 28rpx;
|
||
--kole-m-gutter: 32rpx;
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
align-items: stretch;
|
||
min-height: var(--kole-m-stepper-height);
|
||
border: 1rpx solid var(--kole-color-border);
|
||
border-radius: var(--kole-m-stepper-radius);
|
||
background-color: var(--kole-color-card-bg);
|
||
color: var(--kole-color-text-body);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.kole-m-stepper--round { --kole-m-stepper-radius: 999rpx; }
|
||
|
||
/* 变体 size=small:视觉 72rpx(= 36px)紧凑;热区外扩回 88rpx */
|
||
.kole-m-stepper--small {
|
||
--kole-m-stepper-height: 72rpx;
|
||
--kole-m-stepper-btn: 72rpx;
|
||
}
|
||
|
||
.kole-m-stepper__minus,
|
||
.kole-m-stepper__plus {
|
||
flex-shrink: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: var(--kole-m-stepper-btn);
|
||
min-height: var(--kole-m-stepper-height);
|
||
background-color: var(--kole-color-table-header-bg);
|
||
color: var(--kole-color-text-body);
|
||
font-size: var(--kole-m-font-size-title);
|
||
}
|
||
|
||
.kole-m-stepper__minus { border-right: 1rpx solid var(--kole-color-border); }
|
||
.kole-m-stepper__plus { border-left: 1rpx solid var(--kole-color-border); }
|
||
|
||
/* 到边界(或整组禁用)→ 原位置灰,不隐藏 */
|
||
.kole-m-stepper__minus.is-disabled,
|
||
.kole-m-stepper__plus.is-disabled,
|
||
.kole-m-stepper.is-minus-disabled .kole-m-stepper__minus,
|
||
.kole-m-stepper.is-plus-disabled .kole-m-stepper__plus {
|
||
color: var(--kole-color-text-disabled);
|
||
background-color: var(--kole-color-disabled-bg);
|
||
}
|
||
|
||
.kole-m-stepper.is-disabled .kole-m-stepper__value,
|
||
.kole-m-stepper.is-disabled .kole-m-stepper__value-input {
|
||
color: var(--kole-color-text-disabled);
|
||
background-color: var(--kole-color-disabled-bg);
|
||
}
|
||
|
||
.kole-m-stepper__value,
|
||
.kole-m-stepper__value-input {
|
||
flex: 1;
|
||
min-width: 88rpx;
|
||
min-height: var(--kole-m-stepper-height);
|
||
padding: 0 16rpx;
|
||
text-align: center;
|
||
font-size: 32rpx;
|
||
color: var(--kole-color-text-body);
|
||
}
|
||
|
||
.kole-m-stepper__unit {
|
||
flex-shrink: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
padding-right: 24rpx;
|
||
color: var(--kole-color-text-secondary);
|
||
font-size: var(--kole-m-font-size-label);
|
||
}
|
||
</style>
|