V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Colorful

在写 vue 用 swpier 组件的时候,碰到个问题,求指教

  •  
  •   Colorful · Mar 26, 2019 · 2394 views
    This topic created in 2602 days ago, the information mentioned may be changed or developed.

    这个是写在 data 里面的 swiperOption: { direction: 'vertical', slidesPerView: 1, spaceBetween: 300, mousewheel: true, loop:true, pagination: { el: '.swiper-pagination', type: 'bullets', clickable: true }, on:{ // 使用 es6 的箭头函数,使 this 指向 vue 对象 slideChange: ()=>{ let aswiper = this.$refs.mySwiper.swiper;

            // this.$nextTick(() => {
            我想用滚轮获取它当前的索引
            
            
            
            但用 $nextTick 事件的时候,报错:
            
            
            "TypeError: Cannot read property 'activeIndex' of null"
            
            
            应该是生命周期的原因,但是写在 methods 里面去也是报错,直接页面错误
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   954 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 19:10 · PVG 03:10 · LAX 12:10 · JFK 15:10
    ♥ Do have faith in what you're doing.