12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <template>
- <scroll-view @scroll="onScroll" style="flex: 1;">
- <view v-for="i in 60" class="content-item">
- <text class="text">item-{{i}}</text>
- </view>
- </scroll-view>
- </template>
- <script>
- export default {
- data() {
- return {
- count: 0,
- ret: true
- }
- },
- onLoad() {
- },
- methods: {
- onScroll() {
- this.count++
- console.log("scroll: ", this.count)
- uni.createSelectorQuery()
- .in(this)
- .selectAll('content-item')
- .boundingClientRect()
- .exec((result) => {
- this.count--
- })
- console.log("scroll: ", this.count)
- if (this.count > 0) {
- this.ret = false
- }
- }
- }
- }
- </script>
- <style>
- </style>
|