134134 >
135135 <template v-if =" ! isLoading " >
136136 <div
137- v-html ="
137+ :class =" displayVolumePercent(props.row.dailyVolume, props.row.dailyrangeVolume, true)"
138+ >
139+ {{
138140 displayVolumePercent(
139141 props.row.dailyVolume,
140142 props.row.dailyrangeVolume
141143 )
142- "
143- / >
144+ }}
145+ </ div >
144146 </template >
145147 <b-skeleton :active =" isLoading" />
146148 </b-table-column >
155157 :visible =" nbDays === '7'"
156158 >
157159 <template v-if =" ! isLoading " >
158- <div
159- v-html ="
160+ <div
161+ :class =" displayVolumePercent(props.row.weeklyVolume, props.row.weeklyrangeVolume, true)"
162+ >
163+ {{
160164 displayVolumePercent(
161165 props.row.weeklyVolume,
162166 props.row.weeklyrangeVolume
163167 )
164- "
165- / >
168+ }}
169+ </ div >
166170 </template >
167171 <b-skeleton :active =" isLoading" />
168172 </b-table-column >
177181 :visible =" nbDays === '30'"
178182 >
179183 <template v-if =" ! isLoading " >
180- <div
181- v-html ="
184+ <div
185+ :class =" displayVolumePercent(props.row.monthlyVolume, props.row.monthlyrangeVolume, true)"
186+ >
187+ {{
182188 displayVolumePercent(
183189 props.row.monthlyVolume,
184190 props.row.monthlyrangeVolume
185191 )
186- "
187- / >
192+ }}
193+ </ div >
188194 </template >
189195 <b-skeleton :active =" isLoading" />
190196 </b-table-column >
@@ -317,7 +323,6 @@ export default class SeriesTable extends mixins(PrefixMixin) {
317323 protected nbRows = ' 10'
318324 protected sortBy: SortType = { field: ' volume' , value: - 1 }
319325 public isLoading = false
320-
321326 public meta: NFTMetadata = emptyObject <NFTMetadata >()
322327
323328 async created() {
@@ -403,15 +408,25 @@ export default class SeriesTable extends mixins(PrefixMixin) {
403408 return sanitizeIpfsUrl (meta .image || ' ' )
404409 }
405410
406- public displayVolumePercent(priceNow : number , priceAgo : number ) {
411+ public displayVolumePercent(
412+ priceNow : number ,
413+ priceAgo : number ,
414+ getClass ? : boolean
415+ ) {
416+ /* added getClass for getting the class name for the row
417+ * it would be true when you want to return the class name
418+ */
407419 const vol = ((priceNow - priceAgo ) / priceAgo ) * 100
408420 if (vol === 0 || ! parseFloat (String (vol )) || ! isFinite (vol )) {
409- return ' ---'
421+ return getClass ? ' ' : ' ---'
410422 }
411423 const volumePercent = Math .round (vol * 100 ) / 100
412- return volumePercent > 0
413- ? ` <div style="color: #41b883"> +${volumePercent }%</div> `
414- : ` <div class="has-text-danger"> ${volumePercent }%</div> `
424+
425+ if (getClass ) {
426+ return volumePercent > 0 ? ' has-text-success' : ' has-text-danger'
427+ }
428+
429+ return volumePercent > 0 ? ` +${volumePercent }% ` : ` ${volumePercent }% `
415430 }
416431}
417432 </script >
@@ -423,4 +438,5 @@ export default class SeriesTable extends mixins(PrefixMixin) {
423438 color : #000 ;
424439 background-color : $primary ;
425440}
441+
426442 </style >
0 commit comments