当前位置:网站首页>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边栏推荐
- mm中的GAN模型架构
- Architecture: load balancing
- Sysdig analysis container system call
- 有哪些比较推荐的论文翻译软件?
- 洛谷_P2010 [NOIP2016 普及组] 回文日期_折半枚举
- LeedCode1480. Dynamic sum of one-dimensional array
- Bigder:32/100 测试发现的bug开发认为不是bug怎么处理
- Multiprocess programming (II): Pipeline
- TypeError: Cannot read properties of undefined (reading ***)
- Confluence的PDF导出中文文档异常显示问题解决
猜你喜欢

JS interviewer wants to know how much you understand call, apply, bind no regrets series

Cmake basic use

CMake基本使用

秒杀系统设计

DotNet圈里一个优秀的ORM——FreeSql

MySQL 23道经典面试吊打面试官

奥斯陆大学:Li Meng | 基于Swin-Transformer的深度强化学习

Additional: token; (don't read until you finish writing...)

Mutual exclusion and synchronization of threads

130 pages of PPT from the brick boss introduces the new features of Apache spark 3.2 & 3.3 in depth
随机推荐
CMake基本使用
在线预览Word文档
Should you study kubernetes?
写论文可以去哪些网站搜索参考文献?
Leetcode skimming - game 280
NC24840 [USACO 2009 Mar S]Look Up
Is the multitasking loss in pytoch added up or backward separately?
Which websites can I search for references when writing a thesis?
collections. What is the purpose of chainmap- What is the purpose of collections. ChainMap?
NC50965 Largest Rectangle in a Histogram
多进程编程(二):管道
TypeError: Cannot read properties of undefined (reading ***)
Several methods of the minimum value in the maximum value of group query
TypeError: Cannot read properties of undefined (reading ***)
NC50528 滑动窗口
Form form instantiation
布隆过滤器
Understanding and application of least square method
Chinatelecom has maintained a strong momentum in the mobile phone user market, but China Mobile has opened a new track
FRP reverse proxy +msf get shell