function useDomCss()

in packages/bui-utils/src/hooks/useDomCss/index.ts [5:21]


function useDomCss(
  target: BasicTarget,
  computedStyle: string[],
  cb: (res: Record<string, any>) => void,
) {
  useDomReady(() => {
    const ele = getTargetElement(target);
    const style = window.getComputedStyle(ele, null);

    const res = {};
    computedStyle.forEach((key) => {
      res[key] = style?.[key];
    });

    cb?.(res);
  });
}