mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 00:20:26 +08:00
优化代码
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,7 +1,12 @@
|
|||||||
Vue.component("size-capacity-view", {
|
Vue.component("size-capacity-view", {
|
||||||
props:["v-default-text", "v-value"],
|
props:["v-default-text", "v-value"],
|
||||||
|
methods: {
|
||||||
|
composeCapacity: function (capacity) {
|
||||||
|
return teaweb.convertSizeCapacityToString(capacity)
|
||||||
|
}
|
||||||
|
},
|
||||||
template: `<div>
|
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>
|
<span v-else>{{vDefaultText}}</span>
|
||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
@@ -1097,10 +1097,13 @@ window.teaweb = {
|
|||||||
return -1
|
return -1
|
||||||
},
|
},
|
||||||
convertSizeCapacityToString: function (c) {
|
convertSizeCapacityToString: function (c) {
|
||||||
if (c == null || c.count == null || c.unit == null) {
|
if (c == null || c.count == null || c.unit == null || c.unit.length == 0) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return c.count + c.unit.toString().toUpperCase()
|
if (c.unit == "byte") {
|
||||||
|
return c.count + "B"
|
||||||
|
}
|
||||||
|
return c.count + c.unit[0].toUpperCase() + "i" + c.unit.substring(1).toUpperCase()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
web/public/js/utils.min.js
vendored
2
web/public/js/utils.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user