Element UI走馬燈Carousel取消鼠標懸停不自動切換


  el-carouse組件是自帶鼠標事件,要修改則需要清除原有事件,即鼠標的移入事件@mouseenter.native="delHandleMouseEnter"

<el-carousel ref="carousel" trigger="click" arrow="always" height="1060px"  
 @change="changehandle" @mouseenter.native="delHandleMouseEnter">

  方法:

                delHandleMouseEnter() {
                    this.$refs.carousel.handleMouseEnter = () => { };
                },

  但是,這樣在第一次鼠標進入是還是無法觸發handleMouseEnter事件,這只需要在mounted()方法中添加上this.$refs.carousel.handleMouseEnter = () => { };就可以了。

  通過以上的處理,就可以取消鼠標懸停不自動切換的問題,但是也就不能讓切換停止了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM