小程序获取顶部高度,设备信息和时间胶囊位置信息

news/2024/7/19 14:48:43 标签: js, 小程序
 wx.getSystemInfoSync(),//获取设备信息
 try {
  const res = wx.getSystemInfoSync()
  console.log(res.model)
  console.log(res.pixelRatio)
  console.log(res.windowWidth)
  console.log(res.windowHeight)
  console.log(res.language)
  console.log(res.version)
  console.log(res.platform)
} catch (e) {
  // Do something when catch error
}
/*
SDKVersion: "2.18.0"
batteryLevel: 100
benchmarkLevel: 1
brand: "devtools"
deviceOrientation: "portrait"
devicePixelRatio: 3
enableDebug: true
fontSizeSetting: 15
language: "zh_CN"
model: "iPhone 6/7/8 Plus"
pixelRatio: 3
platform: "devtools"
safeArea: {top: 20, left: 0, right: 414, bottom: 736, width: 414, …}
screenHeight: 736
screenWidth: 414
statusBarHeight: 20
system: "iOS 10.0.1"
version: "8.0.5"
windowHeight: 688
windowWidth: 414
*/

wx.getMenuButtonBoundingClientRect(),//时间胶囊位置信息
获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
/*
bottom: 56
height: 32
left: 320
right: 407
top: 24
width: 87
*/

http://www.niftyadmin.cn/n/734088.html

相关文章

LWN:拥有长期锁定page的文件如何truncate()?

点击上方蓝色“Linux News搬运工”关注我们~Long-term get_user_pages() and truncate(): solved at last?By Jonathan CorbetRDMA等技术都需要能把文件映射到内存page里。现在还有一些persistent-memory设备也需要这样的功能,这样就能把文件内容直接映射到内存&am…

vue中request和response请求拦截器

request 请求拦截器,有token值则配置上token值 axios.interceptors.request.use( config>{if(token && config.url ! "/login"){config.headers[Authentication] token}return config; }, error>{console.log(error);Promise.reject(erro…

LWN: 大麻烦!Spectre继续捣乱

点击上方蓝色“Linux News搬运工”关注我们~Grand Schemozzle: Spectre continues to hauntBy Jonathan Corbet对于此前的Spectre v1硬件漏洞,大家通常的理解就是数组越界检查可能会在speculative execution(预测执行)的情况下被绕过&#xf…

js获取页面url地址

function getQueryString(key) {var reg new RegExp("(^|&)" key "([^&]*)(&|$)");var result window.location.search.substr(1).match(reg);return result ? decodeURIComponent(result[2]) : null; }

LWN: 华为EROFS文件系统

点击上方蓝色“Linux News搬运工”关注我们~erofs: promote erofs from staging从LWN上看到,华为的Gao Xiang正在向文件系统维护者申请正式把erofs从staging(候选)状态转为正式支持的文件系统。他在mailing list里面提到,EROFS的目标是希望能够在不太影响…

css实现正片叠底

mix-blend-mode: normal; //正常 mix-blend-mode: multiply; //正片叠底 mix-blend-mode: screen; //滤色 mix-blend-mode: overlay; //叠加 mix-blend-mode: darken; //变暗 mix-blend-mode: lighten; //变亮 mix-blend-mode: color-dodge; //颜色减淡 mix-blend-mode: color-…

Google正视的对手:微信小程序!

点击上方蓝色“Linux News搬运工”关注我们~今天灌个水,翻看https://developer.android.com的时候,看到页面下方弹出一个小窗口,问是否接受Google的survey,闲来无事点开填完了。其中来到下面这个问题的时候,看到微信小…

react生命周期函数渲染循序

挂载,当组件实例被创建并插入 DOM 中时,其生命周期调用顺序如下 constructor(),static getDerivedStateFromProps(不常用),render(),componentDidMount() getDerivedStateFromProps 会在调用 render 方法之前调用&…