How to make tab switching for swiper in WeChat Mini Programs
This article mainly introduces "how to make tab switching in swiper in WeChat Mini Programs". In daily operation, I believe many people have doubts about how to make tab switching in swiper in WeChat Mini Programs. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to make tab switching in WeChat Mini Programs". Next, please follow the editor to study!
WeChat Mini Programs swiper production tab switching
Realize the effect picture:
Switching over tab made by swiper
Index.html
Seside1 Seside2 Seside3 Seside1 Seside2 Seside3
Index.css
.swiper-tab {width: 100%; border-bottom: 2rpx solid # 777777; text-align: center; line-height: 80rpx;} .swiper-tab-list {font-size: 30rpx; display: inline-block; width: 20%; color: # 777777;} .on {color: # da7c0c; border-bottom: 5rpx solid # da7c0c;} .swiper-box {display: block; height: 100%; width: 100%; overflow: hidden }. Swiper-box view {text-align: center;}
Index.js
/ / index.js / / get application instance var app = getApp () Page ({data: {/ / Page configuration winWidth: 0, winHeight: 0, / / tab switch currentTab: 0,}, onLoad: function () {var that = this / / get system information wx.getSystemInfo ({success: function (res) {that.setData ({winWidth: res.windowWidth, winHeight: res.windowHeight});});}, / / sliding switch tab bindChange: function (e) {var that = this; that.setData ({currentTab: e.detail.current}) }, / / Click tab to switch swichNav: function (e) {var that = this; if (this.data.currentTab = e.target.dataset.current) {return false;} else {that.setData ({currentTab: e.target.dataset.current})}). This ends the study of "how to make tab switching in WeChat Mini Programs". I hope to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!