Home » vue » Using q-scroll-area with div

Using q-scroll-area with div

Posted by: admin November 26, 2021 Leave a comment

Questions:

I’m adding q-scroll-area to existing content that works. When I add the q-scroll area, the conditional formatting of v-if does not work (either if I wrap the div with q-scroll-area or wrap it the other way). I want the div element to appear and be scrollable only on v-if show.

    <div @click="show = !show">button</div>
    <div v-if="show">
    <q-scroll-area>Lorem ipsum dolor sit amet, consectetur adipiscing 
    elit.  
    </q-scroll-area>
    </div>

Answers:

In Quasar docs, they set a fixed height to <q-scroll-area> for vertical content. Seems that q-scroll-area has a height of 0 by default.

<div @click="show = !show">button</div>
  <div v-if="show">
    <q-scroll-area style="height: 200px; max-width: 300px;">Lorem ipsum dolor sit amet, consectetur adipiscing 
    elit.  
    </q-scroll-area>
  </div>