当前位置:网站首页>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边栏推荐
- Multi process programming (III): message queue
- LeedCode1480.一维数组的动态和
- Xcode real machine debugging
- v8
- Markdown tutorial
- Is the multitasking loss in pytoch added up or backward separately?
- Implement the foreach method of array
- Introduction of UART, RS232, RS485, I2C and SPI
- Digital twin smart factory develops digital twin factory solutions
- What website can you find English literature on?
猜你喜欢

秒杀系统设计

Multiprocess programming (II): Pipeline

Chapter 3 of getting started with MySQL: database creation and operation
![[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

Should you study kubernetes?

ftrace工具的介绍及使用

mm中的GAN模型架构

MySQL advanced learning notes (III)

FAQ | FAQ for building applications for large screen devices
随机推荐
kubernetes编写yml简单入门
Where can I find the English literature of the thesis (except HowNet)?
Free we media essential tools sharing
NC50528 滑动窗口
[shutter] image component (image component introduction | image constructor | image.network constructor | image.asset constructor)
Architecture: load balancing
[MCU project training] eight way answering machine
What are the projects of metauniverse and what are the companies of metauniverse
带角度的检测框 | 校准的深度特征用于目标检测(附实现源码)
为什么网站打开速度慢?
form表单实例化
Preview word documents online
【Pulsar文档】概念和架构/Concepts and Architecture
setInterval定时器在ie不生效原因之一:回调的是箭头函数
程序分析与优化 - 9 附录 XLA的缓冲区指派
Centos7 one click compilation to build MySQL script
多进程编程(二):管道
Missing number
Multiprocess programming (4): shared memory
免费自媒体必备工具分享