Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to programmatically enable the clamping of lines when it reaches the maximum amount of lines #34

Open
justlester opened this issue Jul 31, 2020 · 3 comments

Comments

@justlester
Copy link

Hi! I just want to ask how to know if the content reaches the maximum line being set.
Let say for example I set the maximum to 5 lines and the text content has only 1 line. I wanted to enable clamping if it reaches more than 5 lines.

The content can be html or text.

  <div v-line-clamp="clampLines" style="word-break:normal!important;">
                        <span v-html="text"></span>
                    </div>
                    <v-divider v-if="clampLines"></v-divider>
                    <v-btn @click="toggleLines" text small block color="primary" class="font-weight-bold">
                        <template v-if="clampLines">Read More</template>
                        <template v-if="!clampLines">Read Less</template>
                    </v-btn>

a little help would be appreciated. Thanks!

@Frondor
Copy link
Owner

Frondor commented Sep 9, 2020

Sorry for the late reply. You need to set clampLines to 5 for that.

@xyzzyxyzzy0077
Copy link

Having the same question as I want to show a read more button only when the text exceeds the limit. Is there any way to do that?

@justlester
Copy link
Author

Sorry for the late reply. You need to set clampLines to 5 for that.

Hi @Frondor,
Sorry, my question is a bit confusing. What I meant to ask is how to dynamically detect text lines if it reaches the maximum clamp lines let say 5. I wanted to programmatically enable the clamping of lines when it reaches the maximum amount of lines.

@justlester justlester changed the title How to detect if content reaches maximum line. How to programmatically enable the clamping of lines when it reaches the maximum amount of lines Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants