Giter Club home page Giter Club logo

text-ellipsis's Introduction

uxcore-cg-text-ellipsis

React cg text ellipsis

NPM version build status Test Coverage Dependency Status devDependency Status NPM downloads

Sauce Test Status

Development

git clone https://github.com/uxcore/uxcore-cg-text-ellipsis
cd uxcore-cg-text-ellipsis
npm install
npm run server

if you'd like to save your install time,you can use uxcore-tools globally.

npm install uxcore-tools -g
git clone https://github.com/uxcore/uxcore-cg-text-ellipsis
cd uxcore-cg-text-ellipsis
npm install
npm run dep
npm run start

Test Case

npm run test

Coverage

npm run coverage

Demo

http://uxcore.github.io/components/cg-text-ellipsis

Contribute

Yes please! See the CONTRIBUTING for details.

Usage

<CgTextEllipsis
  line={2}
  tipAlign="right"
  uniqueKey="text-ellipsis-1"
  text={'哈哈哈我很长哈哈哈我很长哈哈哈我很长哈哈哈我很长哈哈哈我很长哈哈哈我很长哈哈哈我很长哈哈哈我很长'}
/>

Props

Name Type Required Default Comments
line Number false 1 最大行数
text String true 要显示的文本
uniqueKey Number / String true 元素唯一id
ellipsisChar String false '…' 文本超出句末显示的字符串
isTipAlwaysShow Boolean false false 是否总是显示Tip
maxTipWidth Number false 400 Tip的最大宽度
tipAlign String 'left', 'right', 'top', 'bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight' 'topRight' Tip显示的位置
tipTextAlign String 'left', 'center', 'right' 'left' Tip中文本对其方式

Todo

由于代码实现采用的是js递归截取字符串,当文本内容很大,而期望行数较小时,会导致性能不好,需要引入一些算法去优化。

text-ellipsis's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.