简体   繁体   中英

How to stop auto scroll to top in Vue.js

I have a component structure as bellow:

<Search>
 <SearchField>
   <Image>
   <Summary>
   <Suggestion>
 </SearchField>
</Search>
<Product>              <---- this changes depending on UI selection
   <Result>
      <Option>
        <Filter>       <----Here button click auto scrolls up 
...

The issue is When a button on <Filter> component clicked then a modal opens but underneath everything scrolls up automatically. I need to stop that behaviour. No idea how.

Since there are too many components, not sure where exactly need to set that up and how?

I was thinking of applying the clause to the top level component ´`. Would it be correct?

Required to stop auto scroll up when on mobile.

在点击事件上添加.prevent,就像@click.prevent="activeNews(1)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM