Skip to content

Commit c486ab8

Browse files
committed
refactor(IndexList): 删除地区选择索引示例
1 parent 10db1a5 commit c486ab8

File tree

5 files changed

+7
-217
lines changed

5 files changed

+7
-217
lines changed

examples/pages/components/layout/pages/index-list/city-data.js

Lines changed: 0 additions & 123 deletions
This file was deleted.
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
1-
import cityData from './city-data';
2-
31
const sideBarData = [
42
'A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','W','X','Y','Z'
53
]
64

75
Page({
86
data: {
97
scrollTop: 0,
10-
cityData: cityData.city,
11-
sideBarData: sideBarData,
12-
showAreaChoose:true
8+
sideBarData: sideBarData
139
},
1410

1511
onPageScroll(options) {
1612
const scrollTop = options.scrollTop
1713
this.setData({
1814
scrollTop
1915
})
20-
},
21-
22-
onChangeSegement(event){
23-
wx.pageScrollTo({
24-
duration: 0,
25-
scrollTop: 0
26-
})
27-
this.setData({
28-
showAreaChoose:!event.detail.currentIndex
29-
})
3016
}
3117
});

examples/pages/components/layout/pages/index-list/index.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"l-index-list": "/dist/index-list/index",
44
"l-index-anchor": "/dist/index-anchor/index",
55
"l-segment": "/dist/segment/index",
6-
"l-segment-item": "/dist/segment-item/index"
6+
"l-segment-item": "/dist/segment-item/index",
7+
"content-title": "/components/content-title/index"
78
}
89
}
Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,11 @@
11
<wxs src="util.wxs" module="util"></wxs>
2-
3-
<view class="segment-wrapper">
4-
<l-segment bind:linchange="onChangeSegement">
5-
<l-segment-item tab="地区选择" key="1"></l-segment-item>
6-
<l-segment-item tab="通讯录" key="2"></l-segment-item>
7-
</l-segment>
8-
</view>
9-
10-
<view class="index-list-container">
11-
<view wx:if="{{showAreaChoose}}">
12-
<l-index-list
13-
is-stick="{{true}}"
14-
stickOffsetTop="80"
15-
scroll-top="{{scrollTop}}"
16-
sidebar-data="{{sideBarData}}">
17-
<block wx:for="{{cityData}}" wx:key="index">
18-
<view>
19-
<l-index-anchor/>
20-
<block wx:for="{{item.lists}}" wx:key="index">
21-
<view class="city-item-wrapper">
22-
<view class="city-item">{{item}}</view>
23-
</view>
24-
</block>
25-
</view>
26-
</block>
27-
</l-index-list>
28-
</view>
29-
30-
<view wx:if="{{!showAreaChoose}}">
2+
<view class='container'>
3+
<content-title name="IndexList" describe="索引列表">
314
<l-index-list
325
scroll-top="{{scrollTop}}"
33-
stickOffsetTop="80"
346
l-selected-class="l-selected-class"
357
l-tip-class="l-tip-class"
8+
style="width:100%"
369
l-tip-text-class="l-tip-text-class">
3710
<block wx:for="{{26}}" wx:key="index" wx:for-index="anchorIndex">
3811
<l-index-anchor/>
@@ -45,5 +18,5 @@
4518
</block>
4619
</block>
4720
</l-index-list>
48-
</view>
21+
</content-title>
4922
</view>

examples/pages/components/layout/pages/index-list/index.wxss

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,3 @@
1-
.segment-wrapper{
2-
position: fixed;
3-
top: 0;
4-
left: 0;
5-
right: 0;
6-
height: 80rpx;
7-
display: flex;
8-
justify-content: center;
9-
align-items: center;
10-
width: 100%;
11-
background-color: white;
12-
z-index: 999;
13-
}
14-
15-
l-segment{
16-
width: 100%;
17-
}
18-
19-
.title {
20-
background-color: #494949;
21-
}
22-
23-
.city-item-wrapper {
24-
width: 100%;
25-
background-color: white;
26-
display: flex;
27-
align-items: center;
28-
font-size: 26rpx;
29-
}
30-
31-
.city-item {
32-
margin-left: 30rpx;
33-
margin-right: 60rpx;
34-
width: 100%;
35-
height: 80rpx;
36-
display: flex;
37-
align-items: center;
38-
}
39-
40-
.city-item-wrapper:not(:last-of-type) > .city-item {
41-
border-bottom: 1px solid #f1f1f1;
42-
}
43-
44-
.index-list-container{
45-
padding-top: 80rpx;
46-
}
47-
481
l-index-list{
492
transition: 0.3s;
503
}

0 commit comments

Comments
 (0)