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