-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
102 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 2021.03.02 v1.0.8 更新日志 | ||
|
||
1. 新增 splitThousand 千分位分割方法 | ||
|
||
# 2021.03.01 v1.0.7 更新日志 | ||
|
||
1. 修复 nextIndex 的 bug | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
require('core-js/modules/es.date.to-string.js'); | ||
require('core-js/modules/es.object.to-string.js'); | ||
require('core-js/modules/es.regexp.exec.js'); | ||
require('core-js/modules/es.regexp.to-string.js'); | ||
require('core-js/modules/es.string.replace.js'); | ||
require('core-js/modules/es.string.split.js'); | ||
|
||
/** | ||
* splitThousand | ||
* @description 数字千分位分割 | ||
* @param [String, Number] value 数字 | ||
* @returns {String} 分割后的字符串 | ||
*/ | ||
function splitThousand(val) { | ||
if (!val) return val === 0 || val === '0' ? 0 : ''; | ||
val = val.toString(); | ||
if (val.split('.').length == 1) return (val || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); | ||
return val.split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$&,') + '.' + val.split('.')[1]; | ||
} | ||
|
||
module.exports = splitThousand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use strict'; | ||
|
||
/** | ||
* 阻止冒泡 | ||
* @description 阻止冒泡 | ||
* @param {Object} e dom的event对象 | ||
* @returns {Boolean} | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!bin/sh | ||
|
||
cd - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* splitThousand | ||
* @description 数字千分位分割 | ||
* @param [String, Number] value 数字 | ||
* @returns {String} 分割后的字符串 | ||
*/ | ||
function splitThousand(val) { | ||
if (!val) return val === 0 || val === '0' ? 0 : '' | ||
val = val.toString() | ||
if (val.split('.').length == 1) return (val || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') | ||
return val.split('.')[0].replace(/(\d)(?=(?:\d{3})+$)/g, '$&,') + '.' + val.split('.')[1] | ||
} | ||
|
||
export default splitThousand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* 阻止冒泡 | ||
* @description 阻止冒泡 | ||
* @param {Object} e dom的event对象 | ||
* @returns {Boolean} | ||
*/ | ||
|