Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
data-key的问题
  • Loading branch information
maplejan committed Jul 21, 2014
1 parent a281b59 commit 069b836
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/app/renderPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ define(['Zepto', 'base/charTool', 'app/ArticleModel'], function ($, charTool, Ar
var lineCharCounter = 0; // 每行字数计数器
var spaceWidth = 0; // 剩余空白区域宽度
var curChar = ''; // 当前检索的字符
var wordNum = 0; // 文字编号

for (var i = 0, l1 = articleModel.length; i < l1; i++) {
var j = 0,
Expand All @@ -41,15 +42,15 @@ define(['Zepto', 'base/charTool', 'app/ArticleModel'], function ($, charTool, Ar
lineWidth += articleModel[i][j].width;
if (lineWidth <= pageW) { // 每行未满
//lineStr += '<span data-key="'+ j +'">' + curChar + '</span>';
lineStr += wrapChar(curChar, j);
lineStr += wrapChar(curChar, wordNum++);
lineCharCounter += curChar.length;
j++;
} else { // 每行已满
// 获取所剩空白区域
spaceWidth = pageW - lineWidth + articleModel[i][j].width;
if (charTool.isEndChar(curChar)) {
//lineStr += '<span data-key="'+ j +'">' + curChar + '</span>';
lineStr += wrapChar(curChar, j);
lineStr += wrapChar(curChar, wordNum++);
spaceWidth = spaceWidth - articleModel[i][j].width;
lineCharCounter += curChar.length;
j++;
Expand Down

0 comments on commit 069b836

Please sign in to comment.