Authored by yyq

widget btn number

@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <WidgetFav 14 <WidgetFav
15 class="comment-fav" 15 class="comment-fav"
16 :comment-id="parentComment.id" 16 :comment-id="parentComment.id"
17 - :num="parentComment.praiseTotal" 17 + :num="praiseTotal"
18 :option="favOption"></WidgetFav> 18 :option="favOption"></WidgetFav>
19 </div> 19 </div>
20 </div> 20 </div>
@@ -102,6 +102,15 @@ export default { @@ -102,6 +102,15 @@ export default {
102 }, 102 },
103 replyMoreText() { 103 replyMoreText() {
104 return this.isShowAllReply ? '收起' : `查看${this.moreReplyNum}条回复`; 104 return this.isShowAllReply ? '收起' : `查看${this.moreReplyNum}条回复`;
  105 + },
  106 + praiseTotal() {
  107 + let praiseTotal = this.parentComment.praiseTotal || 0;
  108 +
  109 + if (praiseTotal > 999) {
  110 + return Math.floor(praiseTotal / 1000) + 'k';
  111 + }
  112 +
  113 + return praiseTotal;
105 } 114 }
106 }, 115 },
107 methods: { 116 methods: {
@@ -191,9 +200,13 @@ export default { @@ -191,9 +200,13 @@ export default {
191 } 200 }
192 201
193 .comment-nav-right { 202 .comment-nav-right {
  203 + width: 90px;
194 display: flex; 204 display: flex;
195 align-items: center; 205 align-items: center;
196 - padding-right: 20px; 206 +
  207 + .comment-fav {
  208 + position: absolute;
  209 + }
197 } 210 }
198 211
199 .comment-cont { 212 .comment-cont {
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 </div> 7 </div>
8 </i> 8 </i>
9 <p v-if="viewText" class="icon-btn-text" :style="textStyle"> 9 <p v-if="viewText" class="icon-btn-text" :style="textStyle">
10 - <span class="view-text">{{Number(viewText) > 0 ? viewText : ''}}</span> 10 + <span class="view-text">{{viewText}}</span>
11 <span class="placeholder-text">{{placText}}</span> 11 <span class="placeholder-text">{{placText}}</span>
12 </p> 12 </p>
13 </div> 13 </div>
@@ -153,7 +153,13 @@ export default { @@ -153,7 +153,13 @@ export default {
153 return style; 153 return style;
154 }, 154 },
155 viewText() { 155 viewText() {
156 - return `${(this.editText === null ? this.text : this.editText)}`; 156 + let text = (this.editText === null ? this.text : this.editText);
  157 +
  158 + if (!isNaN(Number(text))) {
  159 + text = text > 0 ? text : '';
  160 + }
  161 +
  162 + return text;
157 }, 163 },
158 placText() { 164 placText() {
159 if (!isNaN(Number(this.text)) && this.viewText.length) { 165 if (!isNaN(Number(this.text)) && this.viewText.length) {