export default {
data(){
return{
date:[]
}
},
methods:{
getInitialUsers async () {
let res = await get_message.get('http://localhost:3000/json')
this.date.push(res)
console.log(this.date)
},
scroll(){
window.onscroll = () =>{
// console.log ( "scroll bar to scroll distance", document.documentElement.scrollTop)
// console.log ( "visual window height", window.innerHeight)
// console.log ( "height of the element", document.documentElement.offsetHeight)
let bottomOfWindow = document.documentElement.scrollTop + window.innerHeight === document.documentElement.offsetHeight
console.log ( "slid to the bottom", bottomOfWindow)
if (bottomOfWindow) {// user dropdown bottoming
setTimeout(()=>{
this.getInitialUsers () // Get the data transmission request ajax
},1000)
}
}
}
},
mounted(){
this.getInitialUsers () // page is loaded, a data request
this.scroll () // each retransmitted user data acquiring request to the pull-down bottom ajax
}
}