The understanding of Vue v-on:scroll.passive

In the

Vue official website tutorial, it is explained that the new attribute .passive will start the passive listener, that is, the default behavior will understand the trigger. My understanding is that I can write a loop event in the onSroll event, and then if the scrolling process is fast, it won"t be blocked by events in the onSroll.



<!--  ()  -->
<!--  `onScroll`   -->
<!--  `event.preventDefault()`  -->
<div v-on:scroll.passive="onScroll">...</div>


so I wrote this:





    <div id="example-5" v-on:scroll.passive="onScroll" style="width: 300px;height: 300px;border: 4px solid red;overflow: scroll;">
        sou la xi xi xi xi la xi la sou           
                
            sou la xi xi xi xi la xi la sou   
                   
               
         sou la xi xi xi xi la xi la sou         
                 
             sou la xi xi xi xi la xi la sou  
                    
               
        
    </div>
    

<span id="demo">0</span>

var x = 0;
let example5 = new Vue({
    el: "-sharpexample-5",
    methods: {
         onScroll: () => {
             for (var i = 0; i < 10000; iPP) {
                   console.log(i);
             }
         document.getElementById("demo").innerHTML = x += 1;
         }
    }
})

but it feels like scrolling will not be blocked by the for loop, whether I set .passive , or .effecent or does not set . Is my understanding wrong?

Mar.04,2021

first of all, onScroll is not the default behavior of scroll. For example, clicking on the a tag will jump, which is the default behavior. If you use preventDefault or .jump for the a tag, the a jump will be prevented.
so when you write a loop in onScroll, it blocks scrolling behavior.
my understanding is that adding .passive to the a tag will definitely jump, even if you add event.preventDefault or .client, it won't work.


added .passive means that preventDefault () will not be added to the listener function to block the default behavior.
reference MDN addEventListener


is the problem solved?
I looked for information. In the URL
https://www.cnblogs.com/ziyun.
, there is a paragraph:
passive does not guarantee anything

there is no scroll event, only touchstart and touchend and whell, do not mention SCROLL event

I do not know whether VUE has BUG on its official website.

Menu