var homeData = new Vue({ el: '#container', data: { images: [], recommends: [], bigTopicData: [], topicData3: [], topicData4: [], topicData5: [], advertising: [], asideNav: [] }, methods: { getBanners: function(){ var _self = this; $.getJSON("/home/banner").done(function (r) { if (r.code === 0 && r.data) { _self.images = r.data; setTimeout(function(){ if (isPC) { $('#swiper-container').slide({ mainCell:".swiper-wrapper" ,titCell:".swiper-pagination span" ,effect: "leftLoop" ,prevCell:".swiper-button-prev" ,nextCell:".swiper-button-next" ,interTime: 3000 ,autoPlay: true ,autoPage: false ,trigger: "mouseover" }); } else { var swiper = new Swiper('#swiper-container', { loop : true, autoplay: { delay: 3000, disableOnInteraction: false }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' }, pagination: { el: '.swiper-pagination', type: 'bullets', clickable :true } }); } },500); } }); }, getRecommends: function(){ var _self = this; $.getJSON("/home/recommend").done(function (r) { if (r.code === 0 && r.data) { _self.recommends = r.data; setTimeout(function(){ $('#recommendBox').slide({ mainCell:"ul.bd" ,titCell:"ul.hd li" ,effect: "leftLoop" ,interTime: 2000 ,autoPlay: true ,scroll:3 ,vis:3 ,pnLoop:false }); },500); } }); }, getAdvertising: function(){ var _self = this; $.getJSON("/home/advertising").done(function (r) { if (r.code === 0 && r.data) { _self.advertising = r.data; } }); }, getTopicData: function(){ var _self = this; $.getJSON("/home/topic").done(function (r) { if (r.code === 0 && r.data) { _self.bigTopicData = r.data.bigTopicData; _self.topicData3 = r.data.topicData3; _self.topicData4 = r.data.topicData4; _self.topicData5 = r.data.topicData5; setTimeout(function(){ _self.setAsideNav(); },500) } }); }, setAsideNav: function(){ var _self = this; var titArr = $('.floorTit').find('h2,h3'); for (var i=0; i