diff --git a/index.html b/index.html
index d16c3f7..4f4697a 100644
--- a/index.html
+++ b/index.html
@@ -9,7 +9,7 @@
-
+
diff --git a/src/components/son.vue b/src/components/son.vue
deleted file mode 100644
index 1b0a4e2..0000000
--- a/src/components/son.vue
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
123
- 这是一个子组件{{ a }}
-
-
-
-
\ No newline at end of file
diff --git a/src/pages/home/components/MyMain.vue b/src/pages/home/components/MyMain.vue
index a11556d..2d1355d 100644
--- a/src/pages/home/components/MyMain.vue
+++ b/src/pages/home/components/MyMain.vue
@@ -11,7 +11,6 @@ import BScroll from 'better-scroll'
import { nextTick } from 'vue'
import MostPopular from "@/pages/home/components/MyMostPopular.vue"
import MovieList from "@/pages/home/components/MyMovieList.vue"
-import request from '@/utils'
export default {
components: {
MostPopular,
@@ -19,20 +18,24 @@ export default {
},
data() {
return {
- scroll: null
+ scroll: null,
+ ids: [],
+ total: Infinity,
+ startIndex: 0,
+ more: []
}
- },
- async mounted() {
-
},
methods: {
- async initsoc() {
+ async initsoc(data) {
+ this.startIndex = data.data.length;
await nextTick();
- const el = this.$refs.main;
const box = this.$refs.box;
- console.log(`滚动父元素高度:${el.offsetHeight}`)
- console.log(`滚动子元素高度:${box.offsetHeight}`)
- console.log(el.offsetHeight)
+ const el = this.$refs.main;
+ // console.log(`滚动父元素高度:${el.offsetHeight}`)
+ // console.log(`滚动子元素高度:${box.offsetHeight}`)
+ // console.log(el.offsetHeight)
+ this.total = data.total;
+ this.ids = data.ids;
let bs = new BScroll(el, {
// ...
pullUpLoad: true,
@@ -40,6 +43,21 @@ export default {
startY: 0,
scrollY: true
})
+ bs.on("pullingUp", () => {
+ const ids = this.ids.slice(this.startIndex, this.startIndex + length)
+ // console.log(this.ids, ids)
+ let data = fetch("http://101.35.148.193:3000/api/movies/more", {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify({
+ ids: ids
+ })
+ })
+ this.more = data.data
+ bs.finishPullUp()
+ })
}
}
}
@@ -62,4 +80,5 @@ export default {
flex-direction: column;
}
}
-
\ No newline at end of file
+
+
diff --git a/src/pages/home/components/MyMostPopular.vue b/src/pages/home/components/MyMostPopular.vue
index b6645c0..e77798d 100644
--- a/src/pages/home/components/MyMostPopular.vue
+++ b/src/pages/home/components/MyMostPopular.vue
@@ -25,8 +25,7 @@