|
|
|
|
@ -216,17 +216,6 @@ export function prepareUrl(url) {
|
|
|
|
|
return new UrlBuilder(url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// export function debounce(fn, delay = 500) {
|
|
|
|
|
// let timer
|
|
|
|
|
// return e => {
|
|
|
|
|
// e.persist()
|
|
|
|
|
// clearTimeout(timer)
|
|
|
|
|
// timer = setTimeout(() => {
|
|
|
|
|
// fn(e)
|
|
|
|
|
// }, delay)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
export const debounce = (func, wait, immediate) => {
|
|
|
|
|
var timeout;
|
|
|
|
|
return function () {
|
|
|
|
|
@ -271,14 +260,6 @@ export function escape2Html(str) {
|
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function formatPrice(price) {
|
|
|
|
|
return Math.ceil(price).toLocaleString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function formatPercent(number) {
|
|
|
|
|
return Math.round(number * 100) + '%';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ! 不支持计算 Set 或 Map
|
|
|
|
|
* @param {*} val
|
|
|
|
|
@ -582,8 +563,7 @@ export function objectMapper(input, keyMap, keep = true) {
|
|
|
|
|
let value = input[key];
|
|
|
|
|
if (map.transform) value = map.transform(value);
|
|
|
|
|
if (typeof map === 'string') mappedObj[map] = value;
|
|
|
|
|
mappedObj[map.key || map] = value;
|
|
|
|
|
// mappedObj[map.key || map] = value;
|
|
|
|
|
mappedObj[map.key || map] = value; // || key
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|