Commit e65a200d by 高淑倩

add: tab

parent bd97eefd
......@@ -18,9 +18,7 @@
"pages/shareNumber/shareNumber",
"pages/cart/cart",
"pages/my/my",
"component/bottom/bottom",
"pages/wantToBuyDetail/wantToBuyDetail",
"component/buyImageSwiper/buyImageSwiper",
"pages/myShare/myShare",
"pages/user-center/user-center",
"pages/productDetail/productDetail",
......
// component/bottomTabs/bottomTabs.js
var app = getApp()
const wxService = require('../../utils/wxService')
const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo
Component({
/**
* 组件的属性列表
*/
properties: {
},
attached () {
},
ready() {
this.setData({
currentRoute: `/${utils.getCurrentPageUrl()}`
})
},
// pages/consumptionDetails/consumptionDetails
observers: {
currentRoute(nRoute, oRoute) {
console.log('nRoute, oRoute', nRoute, oRoute)
const {currentRoute} = this.data
if(nRoute != oRoute){
}
}
},
/**
* 组件的初始数据
*/
data: {
currentRoute: '',
tabs: [
{
active: '/assets/imgs/heart-primary.png',
inactive: '/assets/imgs/heart-default.png',
route: '/pages/consumptionDetails/consumptionDetails'
},
{
active: '/assets/imgs/heart-primary.png',
inactive: '/assets/imgs/heart-default.png',
route: '/pages/home/home'
},
{
active: '/assets/imgs/heart-primary.png',
inactive: '/assets/imgs/heart-default.png',
route: '/pages/my/my'
},
{
active: '/assets/imgs/heart-primary.png',
inactive: '/assets/imgs/heart-default.png',
route: '/pages/productDetail/productDetail'
},
{
active: '/assets/imgs/heart-primary.png',
inactive: '/assets/imgs/heart-default.png',
route: '/pages/refund/refund'
}
],
type: 1
},
/**
* 组件的方法列表
*/
methods: {
handelToPage(e){
const {route} = e.currentTarget.dataset
wxService.router(route)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--component/bottomTabs/bottomTabs.wxml-->
<view class='bgc fixed-bottom0' style="background-image:url('/assets/imgs/7_1_0/bg.png')" wx:if="{{type == 1}}">
<block wx:for="{{tabs}}" wx:key="{{index}}" wx:for-item="tab">
<view
class="tab"
data-route="{{tab.route}}"
bindtap="handelToPage"
>
<image class='tab-img {{index != 2 ? "pdt":""}}' wx:if="{{currentRoute == tab.route}}" src='{{tab.active}}' />
<image class='tab-img {{index != 2 ? "pdt":""}}' wx:else src='{{tab.inactive}}' />
</view>
</block>
</view>
<view class="bottom-tab fixed-bottom0" style="height: 108rpx;" wx:if="{{type == 2}}">
<block wx:for="{{tabs}}" wx:key="{{index}}" wx:for-item="tab">
<view class="tab" data-route="{{tab.route}}" bindtap="handelToPage">
<image class='tab-img' wx:if="{{currentRoute == tab.route}}" src='{{tab.active}}' />
<image class='tab-img' wx:else src='{{tab.inactive}}' />
</view>
</block>
</view>
/* component/bottomTabs/bottomTabs.wxss */
@import './../../base/base.wxss';
.bottom-tab {
display: flex;
align-items: center;
justify-content: center;
}
.tab-img {
width: 50rpx;
height: 50rpx;
}
.tab {
flex: 1;
text-align: center;
}
.bgc {
height: 144rpx;
background-size: 100% 100%;
background-repeat: no-repeat;
display: flex;
align-items: center;
justify-content: center;
}
.pdt {
padding-top: 50rpx;
}
\ No newline at end of file
{
"navigationBarTitleText": "消费详情",
"usingComponents": {
"table": "./../../component/table/table"
"table": "./../../component/table/table",
"bottom-tabs": "./../../component/bottomTabs/bottomTabs"
}
}
\ No newline at end of file
/* pages/consumptionDetails.wxss */
.consumption {
margin: 46rpx;
box-shadow: 0 0 10px #eee;
......
......@@ -14,7 +14,7 @@
"compileType": "miniprogram",
"libVersion": "2.6.6",
"appid": "wxc3b64b09b1d3dfc2",
"projectname": "微商城",
"projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E",
"debugOptions": {
"hidedInDevtools": []
},
......@@ -39,7 +39,7 @@
"list": []
},
"miniprogram": {
"current": 25,
"current": -1,
"list": [
{
"id": -1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment