@@ -23,9 +23,7 @@
}
]
},
- "usingComponents": {
-
- },
+ "usingComponents": {},
"window": {
"navigationBarTextStyle": "black",
"navigationStyle": "custom"
@@ -1,3 +1,4 @@
{
- "component": true
+ "component": true,
+ "usingComponents": {}
+/* custom-tab-bar/index.wxss */
.bottom-section {
position: fixed;
bottom: 0;
@@ -37,24 +38,4 @@
text-align: center;
- .btnSection {
- flex: 1 auto;
- button {
- width: 100%;
- line-height: 88rpx;
- background: linear-gradient(270deg, #FF204B 0%, #FE5B71 100%);
- border-radius: 44rpx;
- font-weight: 500;
- font-size: 32rpx;
- color: #FFFFFF;
- padding-top: 0;
- padding-bottom: 0;
- &[disabled][type=primary] {
- opacity: 0.7;
- }
@@ -1,8 +1,24 @@
+// custom-tab-bar/index.ts
Component({
+
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ },
+ * 组件的初始数据
data: {
selected: 0,
paths: ['pages/index/index', 'pages/orders/orders']
+ * 组件的方法列表
methods: {
switchTab(e: any) {
const data = e.currentTarget.dataset
@@ -12,7 +28,11 @@ Component({
// selected: data.index
// })
console.log(e, 'data', data, this.data.paths[Number(data.id)])
+ const path = this.data.paths[Number(data.id)]
+ wx.switchTab({ path })
+ this.setData({
+ selected: data.id
+ })
})
+<!--custom-tab-bar/index.wxml-->
<view class="bottom-section">
<view class="orders {{ selected === 0 ? 'active' : '' }}" bind:tap="switchTab" data-id="0">
<image wx:if="{{ selected === 0 }}" src="./images/icon-home-active.png" />