Giter Site home page Giter Site logo

wx-diy-tabbar's Introduction

微信小程序自定义 tabbar

由于之前博客讲得比较杂乱,后来重新整理了一下代码结构,新建了一个 Demo 小程序。

其他

如果您希望制作可以左右滑动的带 swiper 效果的 tabbar,可以查看另外一个 Demo

文件构成

具体结构如图:

加载显示

如果希望每次点击 icon 都刷新页面,将 index.wxmlhidden 变为 wx:if,逻辑和 hidden 相反即可。具体差异见下方。

加载一次

<view hidden="{{currentTab == 0? false: true}}">
  <component_index/>
</view>
<view hidden="{{currentTab == 1? false: true}}">
  <component_car/>
</view>
<view hidden="{{currentTab == 2? false: true}}">
  <component_my/>
</view>

每次点击加载

<view wx:if="{{currentTab == 0}}">
  <component_index/>
</view>
<view wx:if="{{currentTab == 1}}">
  <component_car/>
</view>
<view wx:if="{{currentTab == 2}}">
  <component_my/>
</view>

实现效果

image

如果这个 Demo 能够帮助到您。请不要吝惜您的 Star 😊。

wx-diy-tabbar's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.