iter(g117): 指示条与滑块跟随尺寸重算
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user