tab组件为例
3.代码片段
tab.json { "component": true, "usingComponents": {} }
tab.js //跳转到首页 gohome(){ wx.switchTab({ url: '../../pages/home/home' }) }, //跳转到订单页 goorder(){ wx.switchTab({ url: '../../pages/mine/mine' }) }
tab.wxml <view class="tabbar"> <view class="home icon" bindtap="gohome"> <image src="http://47.103.128.16:9004/busiroom/theme/default/images/minApp/img/home2.png" class="image"></image> <view class="text">首页</view> </view> <view class="order icon" bindtap="goorder"> <image src="http://47.103.128.16:9004/busiroom/theme/default/images/minApp/img/mine2.png" class="image"></image> <view class="text">我的</view> </view> </view>
tab.wxss .tabbar{ width: 100%; display: flex; flex-direction: row; justify-content: space-between; height: 95rpx; position: fixed; bottom: 0; background-color: #fff; padding: 10rpx 0 0 0; Box-sizing: border-Box; } .tabbar .icon{ width: 50%; height: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; } .tabbar .icon .image{ width: 55rpx; height: 55rpx; } .tabbar .text{ color: #7F8389; font-size: 20rpx; line-height: 35rpx; }
4.在其他页面使用公共组件
wxml 直接使用创建的page页的命名为标签 <tab></tab>
json //引入公共组件的路径 不需要后缀名 { "usingComponents": { "tab":"../../components/tab/tab" } }
5.展示
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。