Skip to content
Menu
编程侠
  • 首页
  • 资讯
    • 手机
  • 博客
    • 博客vue
    • 博客PHP
  • Q我
编程侠
2021-05-31

uni-app获取元素高度

let footerDom = uni.createSelectorQuery().select('.footer');
footerDom.boundingClientRect(function (data) {
	console.log(data);
	// 打印:{bottom: 672,dataset: {},height: 45,id: "",left: 0,right: 414,top: 627,width: 414}
}).exec();

selectorQuery.select(selector)官方文档

在当前页面下选择第一个匹配选择器 selector 的节点,返回一个 NodesRef 对象实例,可以用于获取节点信息。

selector 说明:

selector 类似于 CSS 的选择器,但仅支持下列语法。
ID选择器:#the-id
class选择器(可以连续指定多个):.a-class.another-class
子元素选择器:.the-parent > .the-child
后代选择器:.the-ancestor .the-descendant
跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
多选择器的并集:#a-node, .some-other-nodes

最新

  • 831密码安全口令
  • 链接跳转到百度地图的指定地址
  • 云服务提到的99.99%的服务可用性,这是个什么概念?
  • 兼容IE的CSS竖排文字代码
  • 网页灰度

标签

831 a标签 canvas clone csrf echarts filter GB2312 grayscale Hello html2canvas iframe prism Unicode UTF-8 wordpress world XSS 不触发 云服务 代码雨 大数据 异常 手机号 打印 拼多多 数组 文字转语音 朗读 正则 深浅拷贝 热力图 竖排 签名验证 编码 编程圈 置灰 背代码 节流 速度 链接 链接跳转 键盘 防抖 验证

友情链接

  • staggering-beauty
  • 编程侠
©2025 编程侠 渝ICP备20006693号-4