vue 使用swiper的一些問題(頁面渲染問題)


//Swiper上下滾動初始化
			swiper_init(){
				this.$nextTick(function(){
					var mySwiper = new Swiper ('.swiper-container', {
						direction: 'vertical', // 垂直切換選項
						autoplay: {//自動播放
							delay: 4000,
							disableOnInteraction: false,//用戶操作swiper之后,是否禁止autoplay。默認為true:停止。
						},
						//當你點擊tab切換時swiper滑動失效
						observer:true,observeParents:true,//這個是啟動動態檢查器(OB/觀眾/觀看者),當改變swiper的樣式(例如隱藏/顯示)或者修改swiper的子元素時,自動初始化swiper。
						loop: true, // 循環模式選項
						slidesPerView: 1,//設置slider容器能夠同時顯示的slides數量
						spaceBetween: 20,//在slide之間設置距離(單位px)。
						mousewheel: true,
						pagination: {//分頁器
						  el: '.swiper-pagination',
						  clickable: true,
						},
						on: {
							// 那些年,那些坑--swiper loop:true引發綁定dom的click事件無效及解決方案
							click: function (res) {
								// 這里有坑
								// 需要注意的是:this 指向的是 swpier 實例,而不是當前的 vue, 因此借助 vm,來調用 methods 里的方法 
								// console.log(this); // -> Swiper
								// 當前活動塊的索引,與activeIndex不同的是,在loop模式下不會將 復制的塊 的數量計算在內。           
								const realIndex = this.realIndex;
								//點擊待審批、待授權、待審計查看詳情
								console.log(realIndex)
								let item='',type=''
								if(vm.activeName=='待審批'){
									item=vm.agencyCenterData.manager.list[realIndex]
									type='審批處理'
								}else if(vm.activeName=='待授權'){
									item=vm.agencyCenterData.keeper.list[realIndex]
									type='授權管理'
								}else if(vm.activeName=='待審計'){
									item=vm.agencyCenterData.auditor.list[realIndex]
									type='審計處理'
								}
								vm.waitingCenter(item,type); 
							}
						},
					})
				})
				
			},

  


免責聲明!

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



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