vue $emit抛出事件


 子组件

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)
	    }

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM