useNumberSeparate
Introduction
数字根据指定数量进行分割
Basic Usage
ts
import { useNumberSeparate } from '@flypeng/tool/browser';
Type Declaration
ts
/**
* 数字根据指定数量进行分割
* @param value
* @param separateNumber
* @returns
*/
declare function useNumberSeparate(value: number, separateNumber?: number = 3): string;
Online Demo
useNumberSeparate
Default Separation Number is 3
123456789:123,456,789Config Separation Number is 4
123456789:1,2345,6789
<script lang="ts" setup>
import { ref } from 'vue';
import { useNumberSeparate } from '@flypeng/tool/browser';
const separateNumber = ref(123456789);
</script>
<template>
<div>
<h4>Default Separation Number is 3</h4>
<span>{{ separateNumber }}:{{ useNumberSeparate(separateNumber, 3) }}</span>
</div>
<div>
<h4>Config Separation Number is 4</h4>
<div>{{ separateNumber }}:{{ useNumberSeparate(separateNumber, 4) }}</div>
</div>
</template>
<style scoped>
div {
margin: 8px 0;
}
</style>