uniApp

uni-app 获取元素大小

2019-10-09  本文已影响0人  GloryMan

获取元素的宽高

const query = uni.createSelectorQuery().in(this);
query.select('.navigate').boundingClientRect(data => {
    console.log(data);
}).exec();

打印结果:
{
    "bottom": 88,
    "height": 88,
    "id": "",
    "width": 375,
    "left": 0,
    "dataset": {
        "eventOpts": [
            ["^clickRightTitle", [
                ["clickRightBarItem"]
            ]],
            ["^clickBack", [
                ["clickLeftBarItem"]
            ]]
        ]
    },
    "right": 375,
    "top": 0
}

上一篇 下一篇

猜你喜欢

热点阅读