About Me
- 🧑💻 Front-end Engineer
- 📍 Shanghai/Hangzhou, China
- ❤️ Heavy music addicts, Amateur photographer ...
- 🌈 Love coding, enjoy life
- 📝 Ask me about anything here
- 👉 Project List
Find Me
Gmail | Github | 掘金 | 语雀 | CSDN |
---|---|---|---|---|
📄 Vue3 component which allows you to ellipsis your multiline text
Home Page: https://sherwinshen.github.io/vue3-text-clamp
License: MIT License
About Me
Find Me
Gmail | Github | 掘金 | 语雀 | CSDN |
---|---|---|---|---|
.text-clamp > span > span {
white-space:pre-wrap;
}
建议加个样式,用于text中包含\n时支持换行
If the text is something long, but there's no spaces, it won't clamp.
Given the clamp will happily cut through the middle of words, it seems like an odd limitation.
想要的效果是最多只能展示三行,但是在 :max-lines=5的情况下最终只能展示一行,改成:max-lines=5才能最多展示三行
How to use it with v-html
directive?
i need render my string
What is the problem?
It is necessary to use not only
Example:
<text-clamp test="Hello world" :max-length="2" tag="h2"/>
What needs to be done?
Implement the change of the div element that defaults to any other HTML element.
Please tell me how to use this component in Nuxt3.js?
I am trying to use the component locally according to the manual:
<template>
<text-clamp text='hello world' :max-lines='2' />
</template>
<script lang='ts' setup>
import TextClamp from 'vue3-text-clamp';
</script>
but I get an error:
TypeError: Cannot read properties of undefined (reading 'defineComponent')
at file:///********/node_modules/vue3-text-clamp/lib/text-clamp.js:1:370
在打包后出现如下异常
Cannot read properties of null (reading ‘isCE‘)
经过查询,是因为库组件中使用的vue版本与项目中的vue版本不一致,最终打包后执行报错
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.