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

Doesn't work correctly when there is block element in after slot #35

Open
lana-k opened this issue Jun 16, 2020 · 3 comments
Open

Doesn't work correctly when there is block element in after slot #35

lana-k opened this issue Jun 16, 2020 · 3 comments

Comments

@lana-k
Copy link

lana-k commented Jun 16, 2020

I need a clamped text with 'read more' button displayed as block element (like this)

So, when I use block element in after slot the vue-clamp hides more lines than needed.

    <v-clamp
      :max-lines="3"
      autoresize
    >
      {{ text }}
      <template #after="{ toggle, expanded, clamped }">
        <div
          v-if="expanded || clamped"
          class="toggle btn btn-sm"
          @click="toggle"
        >
          Read more
        </div>
      </template>
    </v-clamp>
@Justineo
Copy link
Owner

It is expected in current version. You can move the block level element outside. In future versions we may offer more flexibility.

@lana-k
Copy link
Author

lana-k commented Jun 17, 2020

@Justineo it's not obvious, because it's said in the doc:

after
Slot scope: Same as before.
Content displayed after the clamped text. Can contain anything.

Please, change it to

after
Slot scope: Same as before.
Content displayed after the clamped text. Can contain inline-level element.

It should be said explicitly that the inline element is expected.

@helsonxiao
Copy link

This fork may work as you expect? https://boyuai.github.io/vue-clamp/demo/
image

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