Vue telescope is a simple text truncation lib for your Vue3 projects
npm i vue-telescope
import { createApp } from "vue";
import App from "./App.vue";
import telescope from 'vue-telescope'
import "./assets/styling/index.css";
const app = createApp(App)
app.use(telescope)
app.mount('#app')
<template>
<p v-telescope="{ length: 12 }">truncated text</p>
</template>
Or use dynamic values to pass length
<template>
<button @click="state.textLength++">truncated text length is: {{ state.textLength }}</button>
<p v-telescope="{ length: state.textLength }">truncated text</p>
</template>
{length: Number}
MIT