优化代码

This commit is contained in:
刘祥超
2024-01-13 19:31:52 +08:00
parent e1057fc76e
commit ca227a846a
5 changed files with 212 additions and 35 deletions

View File

@@ -1,7 +1,12 @@
Vue.component("size-capacity-view", {
props:["v-default-text", "v-value"],
methods: {
composeCapacity: function (capacity) {
return teaweb.convertSizeCapacityToString(capacity)
}
},
template: `<div>
<span v-if="vValue != null && vValue.count > 0">{{vValue.count}}{{vValue.unit.toUpperCase().replace(/(.)B/, "$1iB")}}</span>
<span v-if="vValue != null && vValue.count > 0">{{composeCapacity(vValue)}}</span>
<span v-else>{{vDefaultText}}</span>
</div>`
})