onReady() {
const query = uni.createSelectorQuery().in(this);
query.select('#scrollItem').fields({size: true,scrollOffset: true}, data => {
console.log("高度啊",data)
}).exec();
},
<view class="swiper " id="scrollItem" v-if="imgUrls.length">
<swiper indicator-dots="true" :autoplay="true" :circular="circular" :interval="interval" :duration="duration"
indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item>
<navigator :url='item.url' class='slide-navigator acea-row row-between-wrapper ' hover-class='none'>
<image :src="item.pic" class="slide-image "lazy-load></image>
</navigator>
</swiper-item>
</block>
</swiper>
</view>
index.js? [sm]:608 高度啊 null
1***@qq.com (作者)
onReady() {
const query = uni.createSelectorQuery();
query.select('#scrollItem').boundingClientRect(data => {
console.log("高度啊",data)
}).exec();
},
这样也不行
2021-08-16 10:28