iter(g117): 指示条与滑块跟随尺寸重算

This commit is contained in:
HIsheR
2026-10-26 14:11:09 +08:00
parent dcd5e0e818
commit 6cf4905a71
4 changed files with 24 additions and 1 deletions
+2
View File
@@ -1,5 +1,6 @@
import { effect, h } from '@ui-arch/frame';
import type { SegmentedProps } from './types.js';
import { trackSize } from './watch.js';
/*** 分段控制器:胶囊分段条 + 滑动滑块,value 信号双向绑定,←→/Home/End 环形导航,整组或单项可禁用 ***/
export function segmented(props: SegmentedProps): HTMLElement {
@@ -59,5 +60,6 @@ export function segmented(props: SegmentedProps): HTMLElement {
effect(sync);
requestAnimationFrame(sync); // 挂载后再量一次布局,否则滑块宽度为 0
trackSize(root, sync); // 尺寸变化后重算滑块位置与宽度
return root;
}