infly-libs
Version:
工具组件库
31 lines (26 loc) • 668 B
JavaScript
/**
* 工具函数集合
*/
/**
* 处理金额显示,限制显示长度
* @param {string} floor_amount - 金额字符串,用分号分隔
* @param {number} length - 显示长度
* @returns {object} 返回包含 vHtml 和 length 的对象
*/
function handleFlowAmount(floor_amount = "", length) {
if (!floor_amount) {
return {
vHtml: "",
length: 0
};
}
const array = floor_amount.split(";");
const limitedArray = array.slice(0, length);
return {
vHtml: limitedArray.join("<br>"),
length: array.length
};
}
export default {
handleFlowAmount
};