|
@@ -17,7 +17,14 @@
|
|
|
}"
|
|
|
v-if="page === 0"
|
|
|
/>
|
|
|
- <pageThird :class="{ animate__animated: true, animate__fadeInUp: isUp,animate__fadeInDown: !isUp}" v-if="page === 1" />
|
|
|
+ <pageThird
|
|
|
+ :class="{
|
|
|
+ animate__animated: true,
|
|
|
+ animate__fadeInUp: isUp,
|
|
|
+ animate__fadeInDown: !isUp,
|
|
|
+ }"
|
|
|
+ v-if="page === 1"
|
|
|
+ />
|
|
|
<pageFifth
|
|
|
:class="{
|
|
|
animate__animated: true,
|
|
@@ -130,15 +137,7 @@ const page = ref(0);
|
|
|
const isUp = ref(true);
|
|
|
let startY = 0;
|
|
|
const isChangePage = cha => {
|
|
|
- let nodes = main.value.childNodes || [];
|
|
|
- let sondiv = null;
|
|
|
- for (let i = 0; i < nodes.length; i++) {
|
|
|
- const ele = nodes[i];
|
|
|
- if (ele.localName !== 'div') continue;
|
|
|
- if (sondiv) break;
|
|
|
- sondiv = ele;
|
|
|
- }
|
|
|
-
|
|
|
+ let sondiv = getinnerele();
|
|
|
// 视口高度 main.value.offsetHeight
|
|
|
// 内容高度 sondiv.offsetHeight
|
|
|
|
|
@@ -168,7 +167,7 @@ const touchend = e => {
|
|
|
// 距离足够则滑动到下一页;
|
|
|
let n = cha > 0 ? 1 : -1;
|
|
|
let dn = n + page.value;
|
|
|
- let len = 12;
|
|
|
+ let len = 11;
|
|
|
isUp.value = n === 1;
|
|
|
// if (dn < 0) dn = len;
|
|
|
// if (dn > len) dn = 0;
|
|
@@ -183,8 +182,23 @@ const touchend = e => {
|
|
|
|
|
|
const touchmove = e => {
|
|
|
const cha = startY - e.changedTouches[0].clientY;
|
|
|
+ const sondiv = getinnerele().offsetHeight;
|
|
|
+ let h = main.value.offsetHeight + main.value.scrollTop;
|
|
|
+ if (sondiv - h <= 5) e.preventDefault();
|
|
|
if (main.value.scrollTop <= 1 && cha < 0) e.preventDefault();
|
|
|
};
|
|
|
+
|
|
|
+const getinnerele = () => {
|
|
|
+ let nodes = main.value.childNodes || [];
|
|
|
+ let sondiv = null;
|
|
|
+ for (let i = 0; i < nodes.length; i++) {
|
|
|
+ const ele = nodes[i];
|
|
|
+ if (ele.localName !== 'div') continue;
|
|
|
+ if (sondiv) break;
|
|
|
+ sondiv = ele;
|
|
|
+ }
|
|
|
+ return sondiv;
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
// 动画库
|