Skip to content

Commit 5cb8b74

Browse files
committed
build: Travis CI automatic compilation
1 parent 5653619 commit 5cb8b74

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

dist/segment/index.js

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

examples/dist/segment/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ Component({
9191
* 组件的初始数据
9292
*/
9393
data: {
94+
// segment-item 绑定的 data-cell 数据
95+
_cells:[],
9496
tabList: [],
9597
currentIndex: 0,
9698
_segmentItemInstances: []
@@ -107,16 +109,20 @@ Component({
107109
if (items.length === this.data.tabList.length && this.data._segmentItemInstances.indexOf(segmentItemInstance) > 0) return;
108110
let activeKey = val,
109111
currentIndex = this.data.currentIndex;
112+
let _cells = [];
110113
const tab = items.map((item, index) => {
111114
activeKey = !val && index === 0 ? item.data.key : activeKey;
112115
currentIndex = item.data.key === activeKey ? index : currentIndex;
116+
// 存储 segment-item 绑定的 data-cell 数据
117+
_cells[index] = item.dataset.cell;
113118
return {
114119
...item.data
115120
};
116121
});
117122
this.setData({
118-
tabList: tab,
123+
_cells,
119124
activeKey,
125+
tabList: tab,
120126
currentIndex,
121127
_segmentItemInstances: items
122128
}, () => {
@@ -150,7 +156,8 @@ Component({
150156
});
151157
this.triggerEvent('linchange', {
152158
activeKey,
153-
currentIndex
159+
currentIndex,
160+
cell:this.data._cells[currentIndex]
154161
});
155162
}
156163
}

0 commit comments

Comments
 (0)