getSafeAreaInsets
功能说明
同步获取当前 Safe Area insets 的值。用于在检查刘海或 Home 指示条等可能遮挡内容区域的边距时使用。
类型
getSafeAreaInsets(): SafeAreaInsets;Params
无。
Response
type SafeAreaInsets = {
top: number;
left: number;
right: number;
bottom: number;
};示例代码
import { SafeArea } from "@apps-in-toss/web-framework";
const insets = SafeArea.get();
document.body.style.paddingTop = `${insets.top}px`;
document.body.style.paddingBottom = `${insets.bottom}px`;这有帮助吗?