子組件
scroll組件
if(this.isBindScroll){ 如果滾動組件需要綁定滾動組件的話
let _this=this
this.scroll.on('scroll',(pos)=>{
_this.$emit('scroll',pos) //子組件拋出事件讓
})
}
父組件
import Scroll from 'src/base/scroll/scroll.vue'
<template>
<scroll class="listview"
@scroll="scroll"> //綁定在調用的子組件上
<scroll>
<template>
methods:{
scroll(pos){ //scroll事件
console.log(pos)
}
