A simple Read More, Read Less I created in Vuejs. This would take tens of lines of code in vanilla JS but just 6 lines of logic in Vue.
Just import the Vue CDN in your script tag.
Could I have done it better?
Let me know your thoughts!
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (8)
Can you help me to make it work. Somehow it is not working in my website. I can't figure out why not as you code is so elegant. I would really like to use it but I think a piece of the puzzle is missing. I just get one button that reads "read more read less". I just copied and pasted your code.... Thanks for a reply in advance!
Hi Liliane. Sorry for the late reply. Did you add the CDN link?
Yes and I got it to work. Thanks again for uploading your example.
Yay! Awesome. Always welcome!
Aha useful example
Righttt! Thank you.
Hi! It is a really good way to do that but its not really working for me because I have to use a variable to store the text. So I did a version which works without static text.dev.to/laur2003/read-more-read-les...
Waiting for a feedback :)
I had implemented show more & show less functionality for list - youtube.com/watch?v=W7wqGVzn1aA