Skip to content
This repository has been archived by the owner. It is now read-only.

Commit 667dfba

Browse files
committed
Update
1 parent 42198cb commit 667dfba

File tree

4 files changed

+64
-56
lines changed

4 files changed

+64
-56
lines changed

example/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
padding: 0;
1212
}
1313

14-
html {
14+
html,body {
1515
height: 100%;
1616
overflow: hidden;
1717
}
1818
</style>
1919
</head>
20-
<body style="height: 100%">
20+
<body>
2121
<div id="app" style="background: #ccc;height: 100%;">
2222
<app-header></app-header>
2323
<router-view></router-view>

example/pages/Home.vue

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,25 @@
6565
</li>
6666
<li>
6767
123
68-
</li><li>
69-
123
70-
</li>
68+
</li>
69+
<li>
70+
123
71+
</li>
72+
<li>
73+
123
74+
</li>
75+
<li>
76+
123
77+
</li>
78+
<li>
79+
123
80+
</li>
81+
<li>
82+
123
83+
</li>
84+
<li>
85+
123
86+
</li>
7187
<li>
7288
123
7389
</li>
@@ -79,23 +95,16 @@
7995
</li>
8096
<li>
8197
123
82-
</li><li>
83-
123
84-
</li><li>
85-
123
86-
</li><li>
87-
123
88-
</li><li>
89-
123
90-
</li><li>
91-
123
92-
</li><li>
93-
123
94-
</li><li>
95-
123
96-
</li><li>
97-
123
98-
</li>
98+
</li>
99+
<li>
100+
123
101+
</li>
102+
<li>
103+
123
104+
</li>
105+
<li>
106+
123
107+
</li>
99108
</ul>
100109
</div>
101110
</fast-scroll>
@@ -104,9 +113,9 @@
104113

105114
<style>
106115
.wrapper {
116+
box-sizing: border-box;
107117
padding-top: 50px;
108118
height: 100%;
109-
z-index: 450;
110119
}
111120
112121
.list-view {
@@ -124,8 +133,7 @@
124133
FastScroll
125134
},
126135
data () {
127-
return {
128-
}
136+
return {}
129137
},
130138
props: {
131139
isBack: true

src/actions.js

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,37 @@ const topAction = {
3333
};
3434

3535
const bottomAction = {
36-
// pull(payload) {
37-
// this.bottomState = 'pull';
38-
// },
39-
//
40-
// trigger(payload) {
41-
// this.bottomState = 'trigger';
42-
// },
43-
//
44-
// loading(payload) {
45-
// this.bottomState = 'loading';
46-
// },
47-
//
48-
// loaded(payload) {
49-
// this.bottomState = 'loaded';
50-
// }
36+
pull(scope) {
37+
scope.bottomState = 'pull';
38+
scope.bottomText = scope.bottomConfig.pullText;
39+
},
40+
41+
pullCancel(scope) {
42+
scope.scrollTo(0);
43+
},
44+
45+
trigger(scope) {
46+
scope.bottomState = 'trigger';
47+
scope.bottomText = scope.bottomConfig.triggerText;
48+
},
49+
50+
loading(scope) {
51+
scope.bottomState = 'loading';
52+
scope.bottomText = scope.bottomConfig.loadingText;
53+
scope.scrollTo(-scope.bottomConfig.stayDistance);
54+
scope.$emit('top-load', scope.topLoaded);
55+
},
56+
57+
loaded(scope, loadState) {
58+
scope.bottomState = 'loaded';
59+
60+
scope.bottomText = loadState === 'done'
61+
? scope.bottomConfig.doneText
62+
: scope.bottomConfig.failText;
63+
setTimeout(() => {
64+
scope.scrollTo(0);
65+
}, scope.bottomConfig.loadedStayTime)
66+
}
5167
}
5268

5369
export { topAction, bottomAction };

src/utils.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,6 @@ const utils = {
33
for (let key in source) {
44
target[key] = source[key];
55
}
6-
},
7-
8-
getScrollTop(element) {
9-
if (element === window) {
10-
return Math.max(window.pageYOffset || 0, document.documentElement.scrollTop);
11-
} else {
12-
return element.scrollTop;
13-
}
14-
},
15-
16-
checkBottomReached() {
17-
if (this.scrollEventTarget === window) {
18-
return document.body.scrollTop + document.documentElement.clientHeight >= document.body.scrollHeight;
19-
} else {
20-
return this.$el.getBoundingClientRect().bottom <= this.scrollEventTarget.getBoundingClientRect().bottom + 1;
21-
}
226
}
237
};
248

0 commit comments

Comments
 (0)