clampy-js / vue-clampy

Vue.js (2+) directive that clamps the content of an element by adding an ellipsis to it if the content inside is too long.
MIT License
78 stars 9 forks source link

How can I use it in a Vue component? #8

Open Somefuture opened 4 years ago

Somefuture commented 4 years ago

I use it in a .vue file like this:

<template>
  <div>
    <p v-clampy="3">
      hello world, you are mine.
    </p>
 </div>
</template>
<script>
import Vue from 'vue'
import clampy from '@clampy-js/vue-clampy'
Vue.use(clampy)
export default {
  name: 'Guideline',
  directives: {
    clampy,
  },
  data() {
    return {}
  },
}
</script>

but it doesn't work.I consoled it in create,and I saw the directives' methods in the console.But it doesn't work.

my vue version is 2.6.11.

Looking forward to your reply!

hvaughan3 commented 4 years ago

Try removing the directives: { clampy } part. I do not have that in my project.

Somefuture commented 4 years ago

Try removing the directives: { clampy } part. I do not have that in my project.

thank you for your reply.I found the problem.I was thinking v-clampy="3" the number 3 means the number of words. But now I found that means rows. Thank you for your reply again.