#修改显示方式

This commit is contained in:
vijay-huang 2020-06-01 16:36:11 +08:00
parent 61405cf324
commit ff998824a0
1 changed files with 11 additions and 5 deletions

View File

@ -26,22 +26,22 @@
</div> </div>
<div class="device-status"> <div class="device-status">
<ul> <ul>
<li>状态 <li>Status:
<span <span
:class="lastItem.status ? 'text-success' : 'text-danger'" :class="lastItem.status ? 'text-success' : 'text-danger'"
v-if="lastItem.status == 0" v-if="lastItem.status == 0"
> >
离线 Offline
</span> </span>
<span <span
:class="lastItem.status ? 'text-success' : 'text-danger'" :class="lastItem.status ? 'text-success' : 'text-danger'"
v-if="lastItem.status == 1" v-if="lastItem.status == 1"
> >
在线 Online
</span> </span>
</li> </li>
<li class="signal">信号 <span>{{lastItem.signal}}</span></li> <li class="signal">Signal: <span>{{lastItem.signal}}/31</span></li>
<li>电量 <span>{{lastItem.energy}}</span></li> <li>Power: <span>{{powerPrecentages}}%</span></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -73,7 +73,13 @@ export default {
const count = this.lastItem.count const count = this.lastItem.count
const qty = 'Qty.' + ' '.repeat(10 - count.length) + '00' + count const qty = 'Qty.' + ' '.repeat(10 - count.length) + '00' + count
return qty.split('') return qty.split('')
},
powerPrecentages() {
const powerMin = 3000
const powerMax = 4950
return parseFloat((this.lastItem.energy - powerMin) / (powerMax - powerMin) * 100).toFixed(1)
} }
}, },
mounted() { mounted() {
} }