This commit is contained in:
oneao committed 2026-10-12 17:32:50 +08:00
1 parent 78eb811ff7
commit 97fe2ff306
83 files changed
+10083 -3662

No files matched your search

@@ -157,5 +157,9 @@ export interface InputFocusOptions {
- **数字模式的取舍**:输入过程保留字符串(否则用户打不出 `12.`),只在 `change` / 失焦时转为 `Number`,空串保持 `''`,避免 `Number('')` 变成 `0`;
- 光标位置在数字过滤后会重新计算(`setSelectionRange`),因此在中间插入非法字符不会把光标弹到末尾;
- 多行模式的高度拖拽用 Pointer Events + `requestAnimationFrame` 合并更新,拖拽期间改的是内联 `height`(从小高度往大拖不会跳变);
- `placeholder` 等原生属性声明为 prop 是刻意的:容器是 `<div>`,如果不声明,`placeholder` 会作为 fallthrough 属性挂到外层容器上,对真实输入框无效;
- **`$attrs` 的落点**:根节点是包裹 `<div>`,真正的 `<input>` / `<textarea>` 在内部,所以组件设了 `inheritAttrs: false` 并手工分流 —— 归属输入行为的属性(`id` / `name` / `autocomplete` / 原生事件等)`v-bind` 到**内部控件**,表达布局的 `class` / `style` 留在**包裹层**。这样 `<label for="x">` 能正确聚焦、`@keydown` 的 `event.target` 是真正的输入框;
- `placeholder` / `autocomplete` / `maxlength` 这类声明为 prop 是历史原因(早期未做 attrs 分流),保留是为了不打断既有调用方 —— 新代码可直接透传原生属性;
- 聚焦样式用 `--g3-color-primary-ring` 画 2px 外环(而非 `outline`),这样在 `Space` / `Grid` 里不会因为 outline 被相邻元素裁掉。
> 注意:`type` 仅支持 `default` / `password` / `number` / `textarea` 四个值(组件内部据此切换模式与净化逻辑)。传 `url` / `email` 这类原生类型不会生效,会按 `default` 处理 —— 需要在表单里做 URL/邮箱校验时,用 `G3FormItem` 的 `type` 规则。