Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue采坑 #21

Open
clms2 opened this issue Oct 10, 2018 · 0 comments
Open

vue采坑 #21

clms2 opened this issue Oct 10, 2018 · 0 comments

Comments

@clms2
Copy link
Owner

clms2 commented Oct 10, 2018

  • 如果有轮播图并且有多组轮播图需要点击后切换显示指定组,如使用了swiper插件,那么不能在方法里面直接调用new Swiper,否则首次加载可能会加载不出来。可使用侦听器方式,侦听页面渲染后再加载轮播插件:
vm.$watch('packageImgs', function(){  
    vm.$nextTick(function() {  
        //轮播
        if (typeof swiper != 'undefined') {
            swiper.destroy();
        }
        swiper = new Swiper('.swiper-container', {
            pagination: '.swiper-pagination',
            nextButton: '.swiper-button-next',
            prevButton: '.swiper-button-prev',
            paginationClickable: true,
            spaceBetween: 0,
            centeredSlides: true,
            autoplay: 3000,
            autoplayDisableOnInteraction: false,
            loop: true,
            paginationType: 'fraction',
        });
    });  
}) 
  • 如果使用的是vue-resource, 那么当使用this.$http.post时除了第二个参数指定传递的参数外,可能还需要加个第三个参数, {emulateJSON:true},后端才能正确的获得传参。。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant