# Object wx.getOfficialComponentsInfo()
基础库 3.7.12 开始支持,低版本需做兼容处理。
微信 Windows 版:支持
微信 Mac 版:支持
# 功能描述
获取所有官方组件的相关信息
# 返回值
# Object
全部组件的信息
属性 | 类型 | 说明 | |||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
notificationComponentInfo | Object | 通知组件信息 | |||||||||||||||||||||||||||||||||||||||||||||||||
|
# 示例代码
const componentsInfo = wx.getOfficialComponentsInfo();
const { notificationComponentInfo } = componentsInfo;
if (notificationComponentInfo.isShow) {
console.log(notificationComponentInfo.boundingClientRect.width);
console.log(notificationComponentInfo.boundingClientRect.height);
console.log(notificationComponentInfo.boundingClientRect.top);
console.log(notificationComponentInfo.boundingClientRect.left);
console.log(notificationComponentInfo.boundingClientRect.bottom);
console.log(notificationComponentInfo.boundingClientRect.right);
}