Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to replace "read more" into vuetify icon in Vue.js?

I’m trying to create photo and description shown below.

How to replace the "read more" and "read less" with arrow icon(up and down)?

<template>
      <v-col cols="6" >
        <row align="center" justify="center">
          <div id="app" class="container">
              <p>A simple Read More, Read Less pen in Vue.js</p>
            
              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Venenatis lectus magna
                fringilla urna. Etiam tempor orci eu lobortis. Integer quis auctor elit sed vulputate mi sit. Lacinia
                at quis risus sed vulputate odio ut enim blandit. Nibh praesent tristique magna sit amet purus. Eleifend donec pretium vulputate sapien nec
                sagittis. Facilisi morbi tempus iaculis urna id volutpat. Ultrices neque ornare aenean euismod.<span v-if="readMore"></span>
                <span v-else>...</span>
              </p>
            
              <p v-show="readMore">Ligula ullamcorper malesuada proin libero nunc consequat interdum varius. Turpis egestas pretium aenean pharetra magna ac
                placerat. Sed egestas egestas fringilla phasellus faucibus scelerisque eleifend donec. Sed cras ornare arcu dui. Aliquam vestibulum
                morbi blandit cursus. Adipiscing elit ut aliquam purus sit amet. Aenean sed adipiscing diam donec adipiscing tristique risus nec. Ut etiam sit amet
                nisl purus in mollis. Eu mi bibendum neque egestas congue quisque egestas diam in. Pellentesque adipiscing
                commodo elit at imperdiet dui accumsan sit.
              </p>
              <button class="btn btn-success" @click="readMore =! readMore">
                <span v-if="readMore">Read Less</span>
                <span v-else>Read More</span>
              </button>
          </div>
        </row>
      </v-col>
    </v-col>

Here is the boolean

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<script>
   data() {
       readMore: false
   }
</script>

>Solution :

Just use the v-icon component that wraps the icon name :

<v-icon v-if="readMore"> mdi-arrow-down </v-icon>
<v-icon v-else> mdi-arrow-up </v-icon>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading