获取盒子高度

32 阅读1分钟
mounted() {
    this.getBoxSize();
},

methods: {
	getBoxSize() {
        uni.createSelectorQuery()
            .select('.header')
            .boundingClientRect((rect) => {
                this.boxHeight = rect.height; // 盒子的高度,单位为px
            })
            .exec();
    },
}
this.$nextTick(() => {});