V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Colorful
V2EX  ›  前端开发

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

  •  
  •   Colorful · 2019-03-26 10:03:14 +08:00 · 1995 次点击
    这是一个创建于 1856 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这个是写在 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 里面去也是报错,直接页面错误
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2717 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:51 · PVG 23:51 · LAX 08:51 · JFK 11:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.