当前位置:网站首页>微信小程序获取某个元素的信息(高、宽等),并将px转换为rpx。
微信小程序获取某个元素的信息(高、宽等),并将px转换为rpx。
2022-07-02 23:09:00 【Pumpkin_xiaoXuan】
<!-- 自定义底部导航栏 这里得定义个class跟下方的.select()一致-->
<tab-bar class="tabbar" :currentTabBar="0" :themeColors="themeColors"></tab-bar>
// 获取底部导航栏高度
getTabBarHeight() {
let query = uni.createSelectorQuery().in(this);
query
.select(".tabbar") // 这里的.tabbar为该元素的类名
.boundingClientRect()
.exec((res) => {
let system = uni.getSystemInfoSync();
let tabBarHeightPx = res[0].height;
let rpx = system.windowWidth / 750;
this.tabBarHeightRpx = tabBarHeightPx / rpx
console.log('tabBarHeightRpx', this.tabBarHeightRpx);
})
},
// 调用时需要等dom渲染完毕再调用
this.$nextTick(() => {
this.getFixedItemInfo()
this.getTabBarHeight()
})// 这里是把拿到的高度转换为rpx,因为在不同机型下 px转rpx是不一致的
let system = uni.getSystemInfoSync();
let tabBarHeightPx = res[0].height;
let rpx = system.windowWidth / 750;
this.tabBarHeightRpx = tabBarHeightPx / rpx边栏推荐
- [shutter] Introduction to the official example of shutter Gallery (learning example | email application | retail application | wealth management application | travel application | news application | a
- Pat 1030 travel plan (30 points) (unfinished)
- Multiprocess programming (II): Pipeline
- Chinatelecom has maintained a strong momentum in the mobile phone user market, but China Mobile has opened a new track
- UART、RS232、RS485、I2C和SPI的介绍
- How to write the design scheme of the thesis?
- Digital collection trading website domestic digital collection trading platform
- pageoffice-之bug修改之旅
- 秒杀系统设计
- Explain in detail the process of realizing Chinese text classification by CNN
猜你喜欢

Practical series - free commercial video material library

Maya fishing house modeling

Custom throttling function six steps to deal with complex requirements

DotNet圈里一个优秀的ORM——FreeSql
![[target detection] r-cnn, fast r-cnn, fast r-cnn learning](/img/f0/df285f01ffadff62eb3dcb92f2e04f.jpg)
[target detection] r-cnn, fast r-cnn, fast r-cnn learning

请问大家在什么网站上能查到英文文献?

Digital twin smart factory develops digital twin factory solutions

详解用OpenCV的轮廓检测函数findContours()得到的轮廓拓扑结构(hiararchy)矩阵的意义、以及怎样用轮廓拓扑结构矩阵绘制轮廓拓扑结构图
![Luogu_ P2010 [noip2016 popularization group] reply date_ Half enumeration](/img/a3/55bb71d39801ceeee421a0c8ded333.png)
Luogu_ P2010 [noip2016 popularization group] reply date_ Half enumeration

Chapter 3 of getting started with MySQL: database creation and operation
随机推荐
What website can you find English literature on?
Basic 10 of C language: array and pointer
Several methods of the minimum value in the maximum value of group query
[shutter] shutter photo wall (center component | wrap component | clickrrect component | stack component | positioned component | button combination component)
Talk with the interviewer about the pit of MySQL sorting (including: duplicate data problem in order by limit page)
sysdig分析容器系统调用
Markdown tutorial
LeedCode1480.一维数组的动态和
多进程编程(五):信号量
Is there a specific format for English papers?
pageoffice-之bug修改之旅
Pytorch 20 realizes corrosion expansion based on pytorch
Free we media essential tools sharing
Sysdig analysis container system call
Interface difference test - diffy tool
The privatization deployment of SaaS services is the most efficient | cloud efficiency engineer points north
毕业总结
Don't want teachers to see themselves with cameras in online classes? Virtual camera you deserve!
Happy Lantern Festival, how many of these technical lantern riddles can you guess correctly?
哪些软件可以整篇翻译英文论文?