当前位置:网站首页>Wechat applet obtains the information of an element (height, width, etc.) and converts PX to rpx.
Wechat applet obtains the information of an element (height, width, etc.) and converts PX to rpx.
2022-07-03 00:28:00 【Pumpkin_ xiaoXuan】
<!-- Customize the bottom navigation bar Here we have to define class Below heel .select() Agreement -->
<tab-bar class="tabbar" :currentTabBar="0" :themeColors="themeColors"></tab-bar>
// Get the height of the bottom navigation bar
getTabBarHeight() {
let query = uni.createSelectorQuery().in(this);
query
.select(".tabbar") // there .tabbar Is the class name of the element
.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);
})
},
// You need to wait while calling dom Call after rendering
this.$nextTick(() => {
this.getFixedItemInfo()
this.getTabBarHeight()
})// Here is to convert the obtained height into rpx, Because in different models px turn rpx It's inconsistent
let system = uni.getSystemInfoSync();
let tabBarHeightPx = res[0].height;
let rpx = system.windowWidth / 750;
this.tabBarHeightRpx = tabBarHeightPx / rpx边栏推荐
- Cmake basic use
- 多进程编程(四):共享内存
- v8
- redis21道经典面试题,极限拉扯面试官
- MySQL 23 classic interview hanging interviewer
- Sysdig analysis container system call
- NC50965 Largest Rectangle in a Histogram
- 教育学大佬是怎么找外文参考文献的?
- Talk with the interviewer about the pit of MySQL sorting (including: duplicate data problem in order by limit page)
- 经济学外文文献在哪查?
猜你喜欢

Multiprocess programming (II): Pipeline

FAQ | FAQ for building applications for large screen devices

写论文可以去哪些网站搜索参考文献?

Install docker and use docker to install MySQL

Architecture: database architecture design
![[shutter] open the third-party shutter project](/img/1a/e35d0180612d7e79b55e7818193740.jpg)
[shutter] open the third-party shutter project

Talk with the interviewer about the pit of MySQL sorting (including: duplicate data problem in order by limit page)

秒杀系统设计

Sysdig analysis container system call

为什么网站打开速度慢?
随机推荐
mm中的GAN模型架构
Where can I find foreign papers?
英文论文有具体的格式吗?
关于Unity屏幕相关Screen的练习题目,Unity内部环绕某点做运动
多进程编程(一):基本概念
Missing number
秒杀系统设计
Sysdig analysis container system call
Implement the foreach method of array
form表单实例化
奥斯陆大学:Li Meng | 基于Swin-Transformer的深度强化学习
Nc50528 sliding window
Don't want teachers to see themselves with cameras in online classes? Virtual camera you deserve!
Maya fishing house modeling
Introduction of UART, RS232, RS485, I2C and SPI
Multiprocess programming (4): shared memory
NC50528 滑动窗口
【雅思阅读】王希伟阅读P1(阅读判断题)
LeedCode1480. Dynamic sum of one-dimensional array
pod生命周期详解