111
This commit is contained in:
1 parent
983674cfc9
commit
96a9bdfec8
18 files changed
+611
-117
No files matched your search
@@ -34,7 +34,6 @@ export const usePage = (
|
||||
const setPage = async (list: Array<any>) => {
|
||||
if (ref == null) return;
|
||||
state.list.totalList = await ref.value.complete(list);
|
||||
console.log(state.list, "list");
|
||||
};
|
||||
const startPage = async (
|
||||
page: number,
|
||||
|
||||
@@ -4,6 +4,27 @@ export const useMoney = (num) => {
|
||||
return (parsedNumber / 100.0).toFixed(1);
|
||||
};
|
||||
|
||||
export function useFormatNum(
|
||||
prefix: string,
|
||||
type: "exact" | string,
|
||||
num: number
|
||||
) {
|
||||
num = num || 0;
|
||||
if (type === "exact") {
|
||||
return prefix + num;
|
||||
}
|
||||
if (num < 10) {
|
||||
return `${prefix}≤10`;
|
||||
}
|
||||
// 情况三:大于 10,除第一位外,其它位都显示为0
|
||||
// 例如:100 - 199 显示为 100+
|
||||
// 9000 - 9999 显示为 9000+
|
||||
const numStr = num.toString();
|
||||
const first = numStr[0];
|
||||
const other = "0".repeat(numStr.length - 1);
|
||||
return `${prefix}${first}${other}+`;
|
||||
}
|
||||
|
||||
export function useTime(time, pattern) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user