search
HomeWeChat AppletMini Program DevelopmentSharing examples of WeChat applet realizing tab switching effect

This article mainly introduces the tab switching effect of WeChat applet in detail. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.

The tab switching effect of the WeChat mini program, as shown in the picture:

Recently I am learning the WeChat mini program and moved the previous company app to the mini program. Pick some implementation effects and record them (mainly things that are not mentioned in the official documents, after all, the official documents only introduce functions)

.wxml code:


<view class="body">
 <view class="nav bc_white">
  <view class="{{selected?&#39;red&#39;:&#39;default&#39;}}" bindtap="selected">系统提醒</view>
  <view class="{{selected1?&#39;red&#39;:&#39;default&#39;}}" bindtap="selected1">优惠活动</view>
 </view>
 <view class="{{selected?&#39;show&#39;:&#39;hidden&#39;}}">for system</view>
 <view class="{{selected1?&#39;show&#39;:&#39;hidden&#39;}}">for activity</view>
</view>

.wxss code:


##

page{background-color:#edf0f3;}
.nav{width:100%;height:100rpx;display:flex;flex-direction:row;}
.default{line-height:100rpx;text-align:center;flex:1;border-right:1px solid gainsboro;color:#000;font-weight:bold;font-size:28rpx;}
.red{line-height:100rpx;text-align:center;color:#fc5558;flex:1;border-right:1px solid gainsboro;font-weight:bold;font-size:28rpx;}
.show{display:block;text-align:center;line-height:200rpx;}
.hidden{display:none;text-align:center;line-height:200px;}

.js code:



Page({
  data:{
    selected:true,
    selected1:false
    },
  selected:function(e){
    this.setData({
      selected1:false,
      selected:true
    })
  },
  selected1:function(e){
    this.setData({
      selected:false,
      selected1:true
    })
  }
})

Related Recommended:


Example details the tab switching effect of vue imitating Taobao order status

Commonly used tab switching effect in js

jquery image tab switching effect_jquery

The above is the detailed content of Sharing examples of WeChat applet realizing tab switching effect. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.