<template>
<view ref="nzScroll" :style="{height: scrollHeight+'px'}" class="nz-scroll" @scroll="handleScroll($event)">
<slot></slot>
</view>
</template>
<script>
export default {
name: 'nz-scroll',
props: {
height: {
type: Number,
default: 0
}
},
data() {
return {
scrollHeight: this.height,
nzScroll: null
}
},
methods: {
handleScroll(event) {
console.log(event);
}
},
mounted() {
this.nzScroll = this.$refs.nzScroll;
console.log(this.nzScroll);
}
}
</script>
<style lang="scss">
.nz-scroll {
overflow-y: scroll;
}
</style>
![CitizenC](https://img-cdn-tc.dcloud.net.cn/account/identicon/51f2b1f0494922faf80d37837357d26f.png)
CitizenC
- 发布:2019-05-08 11:31
- 更新:2019-05-09 14:35
- 阅读:1472
view监听scroll事件,返回的值没有滚动条的信息。
分类:uni-app
CitizenC (作者)
多谢你的回复,今天才收到消息通知,搞不懂
2019-09-24 15:45