SoFunction
Updated on 2025-04-03

vue listening page scrolls to a certain height to trigger event flow

Listen to a certain height to trigger the event

methods: {
   showIcon() {
      if (
        !! &&
         > 200
       ) {            
            The page height is greater than200Perform an action
        } else {
             Page height is less than200Perform an action
        }
    },
}

Listen to events

mounted() {
    ("scroll", );
},

Dynamic monitoring page scroll height

//Get the page scrolling heightmethods:{
      scrollHandle(e){
      let top = ;    // Get the page scrolling height      (top);
        }
}
mounted(){
          ('scroll',);//Binding page scroll event      },

The above is personal experience. I hope you can give you a reference and I hope you can support me more.