微信小程序,uniapp,uview获得元素高度
2023-09-11 14:19:37 时间
微信小程序:
let query = wx.createSelectorQuery(); query.select('.find').boundingClientRect(res => { console.log(res.height); // 1545.7249755859375 }).exec();
uniap:
uni.getSystemInfo({ success: function(res) { // res - 各种参数 console.log(res.windowWidth); // 屏幕的宽度 let info = uni.createSelectorQuery().select(".类名"); info.boundingClientRect(function(data) { //data - 各种参数 console.log(data.width) // 获取元素宽度 }).exec() } });
uview:
export default { methods: { async getElInfo() { let rectInfo = await this.$u.getRect('.类名'); console.log(rectInfo); } } }
转:
https://v1.uviewui.com/js/getRect.html
https://blog.csdn.net/admin_web/article/details/117359984
https://www.csdn.net/tags/NtzaYg0sODgzODYtYmxvZwO0O0OO0O0O.html
相关文章
- 微信小程序入门之构建一个简单TODOS应用
- 微信小程序实时通讯(websocket)问题
- 微信小程序_(案例)简单中国天气网首页
- 微信小程序遇到的问题
- 微信: 如何分享成为卡片(图片、文字)形式?2022年5月
- uni-app:微信小程序登录:获取code时返回the code is a mock one(hbuilderx 3.7.3)
- 微信小程序----手势锁详解
- 微信小程序----map组件实现(高德地图API实现wx.chooseLocation(OBJECT))
- 微信小程序----scroll-view组件(MUI索引列表)滚动动画
- 微信小程序----progress组件
- 微信小程序开发系列 (三) :微信小程序如何响应用户点击事件和微信平台 API 的使用方法介绍
- uni-app在微信小程序中无法拉起用户授权面板,uni.getUserInfo直接返回匿名数据
- 微信小程序wx.previewImage(Object object)真机调试无法全屏预览图片
- 使用base64加密解密的多种方法:分别包含pc端和uniapp微信小程序
- html、vue、uni-app微信小程序的区别
- 微信公众号二维码在哪里看?如何查看自己的微信公众号二维码?
- Android 10.0微信视频通话上下颠倒的解决方案
- 微信小程序:获取不限制的小程序码后端Java实现
- Linux|centos7下部署安装alertmanager并实现邮箱和微信告警(基础篇---二)
- 基于SpringCloud+redis+Springsecurity实现的微信小程序外卖系统