Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
paleface001 authored and 刘叶 committed Nov 12, 2019
1 parent 37742ec commit 40ab245
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/description.ts
Expand Up @@ -80,7 +80,7 @@ export default class TextDescription {
* 1. 注意初始text带换行符的场景
*/
private _textWrapper(width: number, style) {
const text: string = this.text;
const textContent: string = this.text;
const tShape = new Text({
attrs: {
text: '',
Expand All @@ -89,7 +89,7 @@ export default class TextDescription {
...style,
},
});
const textArr = text.split('\n');
const textArr = textContent.split('\n');
const wrappedTextArr = textArr.map((wrappedText) => {
let currentWidth = 0;
const chars = wrappedText.split('');
Expand All @@ -101,7 +101,9 @@ export default class TextDescription {
const textWidth = Math.floor(tShape.measureText());
currentWidth += textWidth;
if (currentWidth > width) {
if (i === 0) break;
if (i === 0) {
break;
}
breakIndex.push(i);
currentWidth = 0;
text = '';
Expand Down

0 comments on commit 40ab245

Please sign in to comment.