Skip to content

Commit d419d28

Browse files
committed
build: Travis CI automatic compilation
1 parent d32969c commit d419d28

File tree

8 files changed

+145
-0
lines changed

8 files changed

+145
-0
lines changed

dist/tab-bar/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tab-bar/index.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"component":true,"styleIsolation":"apply-shared","usingComponents":{"l-badge":"../badge/index"}}

dist/tab-bar/index.wxml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<view class="lu-tab-bar" style="{{bgColor?'background-color:'+bgColor+';':''}} {{bgImg?'background-image: url('+bgImg+');':''}}">
2+
<view class="lu-tab-bar__item-wrapper" data-index="{{index}}" mut-bind:tap="onTapItem" style="width:{{750/list.length}}rpx" wx:for="{{list}}" wx:key="index">
3+
<view class="lu-tab-bar__item-container">
4+
5+
<l-badge show="{{item.redDot}}" dot="{{item.redDot===true}}" value="{{item.redDot}}" data-index="{{index}}" mut-bind:lintap="onTapItem">
6+
<image class="lu-tab-bar__item-image {{selectedIndex===index?'lu-tab-bar__item-image--selected':''}}" src="{{selectedIndex===index?item.selectedIconPath:item.iconPath}}"></image>
7+
</l-badge>
8+
9+
<view wx:if="{{item.text!==undefined}}" class="lu-tab-bar__item-text {{selectedIndex===index?'lu-tab-bar__item-text--selected':''}}" style="color:{{selectedIndex===index?textSelectedColor:textColor}}">
10+
{{item.text}}
11+
</view>
12+
</view>
13+
</view>
14+
</view>

dist/tab-bar/index.wxss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.lu-tab-bar{left:0;right:0;bottom:0;position:fixed;z-index:9999;width:750rpx;height:106rpx;display:flex;background-color:#fff;background-size:100% 100%;background-repeat:no-repeat}.lu-tab-bar__item-wrapper{display:flex;height:100%;justify-content:center}.lu-tab-bar__item-container{display:flex;flex-direction:column;align-items:center;justify-content:center}.lu-tab-bar__item-image{display:block;width:52rpx;height:52rpx}.lu-tab-bar__item-text{margin-top:4rpx;font-size:24rpx;line-height:1}

examples/dist/tab-bar/index.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import eventUtil from '../core/utils/event-util';
2+
Component({
3+
properties: {
4+
// 背景色
5+
bgColor: {
6+
type: String,
7+
value: null
8+
},
9+
// 背景图
10+
bgImg: {
11+
type: String,
12+
value: null
13+
},
14+
// 当前选中索引
15+
selectedIndex: {
16+
type: Number,
17+
value: 0
18+
},
19+
// tab 项
20+
list: {
21+
type: Array,
22+
value: []
23+
},
24+
// 文字选中颜色
25+
textSelectedColor: {
26+
type: String,
27+
value: '#3963bc'
28+
},
29+
// 文字未选中颜色
30+
textColor: {
31+
type: String,
32+
value: '#666'
33+
}
34+
},
35+
36+
data: {
37+
// 当前选中项索引
38+
selectedIndex: 0
39+
},
40+
41+
pageLifetimes: {
42+
show: function () {
43+
// 切换 tab 选中项
44+
this.parseCurrentPage();
45+
}
46+
},
47+
48+
methods: {
49+
50+
/**
51+
* 根据当前页 path,切换 tab 选中项
52+
*/
53+
parseCurrentPage() {
54+
const currentPagePath = '/' + getCurrentPages()[0].route;
55+
const list = this.data.list;
56+
57+
let index;
58+
for (let i = 0; i < list.length; i++) {
59+
if (list[i].pagePath === currentPagePath) {
60+
index = i;
61+
break;
62+
}
63+
}
64+
65+
if (index === undefined) {
66+
return;
67+
}
68+
69+
this.setData({
70+
selectedIndex: index
71+
});
72+
73+
// 触发事件
74+
const item = this.data.list[index];
75+
eventUtil.emit(this, 'linchange', { index, item });
76+
77+
},
78+
79+
/**
80+
* 事件:点击 tab 项
81+
*/
82+
onTapItem(e) {
83+
const index = e.currentTarget.dataset.index;
84+
const url = this.data.list[index].pagePath;
85+
86+
eventUtil.emit(this, 'lintap', { index, item: this.data.list[index] });
87+
88+
if (!url) {
89+
return;
90+
}
91+
// 切换路由
92+
wx.switchTab({
93+
url,
94+
fail() {
95+
wx.navigateTo({
96+
url,
97+
fail(error) {
98+
console.warn('路由跳转错误,错误信息为:', error);
99+
}
100+
});
101+
}
102+
});
103+
}
104+
}
105+
});

examples/dist/tab-bar/index.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"component": true,
3+
"styleIsolation": "apply-shared",
4+
"usingComponents": {
5+
"l-badge":"../badge/index"
6+
}
7+
}

examples/dist/tab-bar/index.wxml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<view class="lu-tab-bar"
2+
style="{{bgColor?'background-color:'+bgColor+';':''}} {{bgImg?'background-image: url('+bgImg+');':''}}">
3+
<view class="lu-tab-bar__item-wrapper" data-index="{{index}}" mut-bind:tap="onTapItem" style="width:{{750/list.length}}rpx" wx:for="{{list}}" wx:key="index">
4+
<view class="lu-tab-bar__item-container">
5+
<!-- 标签图标 -->
6+
<l-badge show="{{item.redDot}}" dot="{{item.redDot===true}}" value="{{item.redDot}}" data-index="{{index}}" mut-bind:lintap="onTapItem">
7+
<image class="lu-tab-bar__item-image {{selectedIndex===index?'lu-tab-bar__item-image--selected':''}}" src="{{selectedIndex===index?item.selectedIconPath:item.iconPath}}"></image>
8+
</l-badge>
9+
<!-- 标签文字 -->
10+
<view wx:if="{{item.text!==undefined}}" class="lu-tab-bar__item-text {{selectedIndex===index?'lu-tab-bar__item-text--selected':''}}" style="color:{{selectedIndex===index?textSelectedColor:textColor}}">
11+
{{item.text}}
12+
</view>
13+
</view>
14+
</view>
15+
</view>

examples/dist/tab-bar/index.wxss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.lu-tab-bar{left:0;right:0;bottom:0;position:fixed;z-index:9999;width:750rpx;height:106rpx;display:flex;background-color:#fff;background-size:100% 100%;background-repeat:no-repeat}.lu-tab-bar__item-wrapper{display:flex;height:100%;justify-content:center}.lu-tab-bar__item-container{display:flex;flex-direction:column;align-items:center;justify-content:center}.lu-tab-bar__item-image{display:block;width:52rpx;height:52rpx}.lu-tab-bar__item-text{margin-top:4rpx;font-size:24rpx;line-height:1}

0 commit comments

Comments
 (0)