widget.qw 1.0.21 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/.env.development +9 -9
  2. package/.env.production +8 -8
  3. package/README.md +73 -73
  4. package/build/style.css +482 -468
  5. package/build/widget.qw.es.js +2429 -1714
  6. package/build/widget.qw.umd.js +2347 -1632
  7. package/index.html +17 -17
  8. package/package.json +47 -47
  9. package/src/App.vue +26 -26
  10. package/src/api/index.js +141 -141
  11. package/src/components/AuditBar.vue +340 -340
  12. package/src/components/BillCard.vue +155 -155
  13. package/src/components/CascaderPicker.vue +87 -110
  14. package/src/components/CascaderPop.vue +330 -339
  15. package/src/components/CheckGroup.vue +113 -113
  16. package/src/components/DatetimePicker/DatetimePop.vue +342 -342
  17. package/src/components/DatetimePicker/index.vue +112 -112
  18. package/src/components/DayDropdown.vue +56 -56
  19. package/src/components/FilePicker.vue +113 -113
  20. package/src/components/Input.vue +71 -71
  21. package/src/components/MonthDropdown.vue +51 -51
  22. package/src/components/MultiPicker.vue +123 -123
  23. package/src/components/SecretNotify.js +5 -5
  24. package/src/components/Sheet.vue +92 -92
  25. package/src/components/SingleApiPicker.vue +112 -112
  26. package/src/components/SinglePicker.vue +102 -102
  27. package/src/components/SingleUserSelector.vue +425 -425
  28. package/src/components/Switch.vue +64 -64
  29. package/src/components/TreePicker.vue +113 -113
  30. package/src/components/UserPicker.vue +106 -106
  31. package/src/components/UserProfile.vue +131 -128
  32. package/src/components/UsersPicker.vue +118 -118
  33. package/src/components/YearDropdown.vue +59 -59
  34. package/src/components/data_selector.vue +280 -280
  35. package/src/components/image_picker.vue +114 -114
  36. package/src/components/images_picker.vue +139 -139
  37. package/src/components/index.js +157 -157
  38. package/src/components/mult_list_selector.vue +155 -155
  39. package/src/components/subdepartment_selector.vue +481 -481
  40. package/src/components/user_selector.vue +639 -639
  41. package/src/components/widget/DataPop.vue +95 -95
  42. package/src/components/widget/TreePop.vue +88 -88
  43. package/src/components/widget/UserPop.vue +347 -347
  44. package/src/main.js +117 -117
  45. package/src/router/index.ts +168 -168
  46. package/src/util/array_util.js +32 -32
  47. package/src/util/auth_util.js +72 -72
  48. package/src/util/bool_util.js +5 -5
  49. package/src/util/bus.js +1 -1
  50. package/src/util/cache_util.js +18 -18
  51. package/src/util/errer_code.js +6 -6
  52. package/src/util/eval_util.js +19 -19
  53. package/src/util/icon_util.js +36 -36
  54. package/src/util/image_util.js +27 -27
  55. package/src/util/index.js +55 -55
  56. package/src/util/num_util.js +70 -70
  57. package/src/util/obj_util.js +28 -28
  58. package/src/util/request.js +73 -73
  59. package/src/util/request_json.js +71 -71
  60. package/src/util/request_json_mute.js +65 -65
  61. package/src/util/request_upload.js +79 -79
  62. package/src/util/route_util.js +31 -31
  63. package/src/util/str_util.js +143 -143
  64. package/src/util/time_util.js +406 -406
  65. package/src/util/toast_util.js +24 -24
  66. package/src/util/tree_util.js +153 -153
  67. package/src/util/validate.js +182 -182
  68. package/src/util/vue_filter.js +223 -223
  69. package/src/views/auditbar/index.vue +65 -65
  70. package/src/views/billcard/index.vue +45 -45
  71. package/src/views/cascaderpicker/index.vue +0 -0
  72. package/src/views/cascaderpop/index.vue +90 -90
  73. package/src/views/checkgroup/index.vue +35 -35
  74. package/src/views/dataSelector/index.vue +48 -48
  75. package/src/views/datetimepicker/index.vue +34 -34
  76. package/src/views/daydropdown/index.vue +31 -31
  77. package/src/views/filepicker/index.vue +31 -31
  78. package/src/views/imagepicker/index.vue +31 -31
  79. package/src/views/imagespicker/index.vue +31 -31
  80. package/src/views/input/index.vue +34 -34
  81. package/src/views/monthdropdown/index.vue +31 -31
  82. package/src/views/multListSelector/index.vue +61 -61
  83. package/src/views/multipicker/index.vue +36 -36
  84. package/src/views/productSelector/index.vue +35 -35
  85. package/src/views/projectdropdown/index.vue +31 -31
  86. package/src/views/projectpicker/index.vue +41 -41
  87. package/src/views/secretnotify/index.vue +27 -27
  88. package/src/views/sheet/index.vue +45 -45
  89. package/src/views/singlepicker/index.vue +35 -35
  90. package/src/views/subdepartmentSelector/index.vue +40 -40
  91. package/src/views/switch/index.vue +34 -34
  92. package/src/views/treepicker/index.vue +41 -41
  93. package/src/views/userSelector/index.vue +54 -54
  94. package/src/views/userSelectorNew/index.vue +45 -45
  95. package/src/views/userpicker/index.vue +43 -43
  96. package/src/views/userprofile/index.vue +30 -30
  97. package/src/views/userspicker/index.vue +43 -43
  98. package/src/views/yeardropdown/index.vue +32 -32
  99. package/src/vm/index.js +1 -1
  100. package/vite.config.ts +122 -122
@@ -1,73 +1,73 @@
1
- import { setCacheValueByKey, getCacheValueByKey, removeCacheByKey } from "./cache_util.js";
2
- import { computed } from 'vue'
3
- import vm from '../vm'
4
-
5
- //登陆token的键名
6
- export const TOKEN_KEY = import.meta.env.VITE_TOKEN_KEY;
7
- export const TOKEN_PREFIX = import.meta.env.VITE_TOKEN_PREFIX;
8
-
9
- export function getToken() {
10
- if (import.meta.env.VITE_IS_DEBUG === 'true')
11
- return TOKEN_PREFIX + import.meta.env.VITE_DEBUG_TOKEN
12
- else if(vm.tokenCallback)
13
- return vm.tokenCallback()
14
- }
15
-
16
- export function setToken(token) {
17
- setCacheValueByKey(TOKEN_KEY, token)
18
- }
19
-
20
- export function removeToken() {
21
- removeCacheByKey(TOKEN_KEY)
22
- }
23
-
24
- export const props2auth = (props) => {
25
- return {
26
- isRequired: computed(() => {
27
- if (props.auth) {
28
- return props.auth == 'require'
29
- }
30
-
31
- return props.required
32
- }),
33
- isGone: computed(() => {
34
- if (props.auth)
35
- return props.auth == 'gone'
36
-
37
- return false
38
- }),
39
- isDisabled: computed(()=>{
40
- if (props.auth)
41
- return props.auth == 'readonly'
42
-
43
- if(props.required)
44
- return false
45
-
46
- if(props.disabled)
47
- return true
48
-
49
- if(props.readonly)
50
- return true
51
-
52
- return false
53
- }),
54
- isReadonly: computed(()=>{
55
- if (props.auth)
56
- return props.auth == 'readonly'
57
-
58
- if(props.readonly)
59
- return true
60
-
61
- if(props.required)
62
- return false
63
-
64
- if(props.disabled)
65
- return true
66
-
67
- return false
68
- }),
69
- rules: computed(()=>{
70
- return props.rules
71
- })
72
- }
1
+ import { setCacheValueByKey, getCacheValueByKey, removeCacheByKey } from "./cache_util.js";
2
+ import { computed } from 'vue'
3
+ import vm from '../vm'
4
+
5
+ //登陆token的键名
6
+ export const TOKEN_KEY = import.meta.env.VITE_TOKEN_KEY;
7
+ export const TOKEN_PREFIX = import.meta.env.VITE_TOKEN_PREFIX;
8
+
9
+ export function getToken() {
10
+ if (import.meta.env.VITE_IS_DEBUG === 'true')
11
+ return TOKEN_PREFIX + import.meta.env.VITE_DEBUG_TOKEN
12
+ else if(vm.tokenCallback)
13
+ return vm.tokenCallback()
14
+ }
15
+
16
+ export function setToken(token) {
17
+ setCacheValueByKey(TOKEN_KEY, token)
18
+ }
19
+
20
+ export function removeToken() {
21
+ removeCacheByKey(TOKEN_KEY)
22
+ }
23
+
24
+ export const props2auth = (props) => {
25
+ return {
26
+ isRequired: computed(() => {
27
+ if (props.auth) {
28
+ return props.auth == 'require'
29
+ }
30
+
31
+ return props.required
32
+ }),
33
+ isGone: computed(() => {
34
+ if (props.auth)
35
+ return props.auth == 'gone'
36
+
37
+ return false
38
+ }),
39
+ isDisabled: computed(()=>{
40
+ if (props.auth)
41
+ return props.auth == 'readonly'
42
+
43
+ if(props.required)
44
+ return false
45
+
46
+ if(props.disabled)
47
+ return true
48
+
49
+ if(props.readonly)
50
+ return true
51
+
52
+ return false
53
+ }),
54
+ isReadonly: computed(()=>{
55
+ if (props.auth)
56
+ return props.auth == 'readonly'
57
+
58
+ if(props.readonly)
59
+ return true
60
+
61
+ if(props.required)
62
+ return false
63
+
64
+ if(props.disabled)
65
+ return true
66
+
67
+ return false
68
+ }),
69
+ rules: computed(()=>{
70
+ return props.rules
71
+ })
72
+ }
73
73
  }
@@ -1,6 +1,6 @@
1
- /**
2
- * bool转中文
3
- */
4
- export function bool2chinese(value) {
5
- return value ? '是' : '否'
1
+ /**
2
+ * bool转中文
3
+ */
4
+ export function bool2chinese(value) {
5
+ return value ? '是' : '否'
6
6
  }
package/src/util/bus.js CHANGED
@@ -1,2 +1,2 @@
1
- import mitt from 'mitt';
1
+ import mitt from 'mitt';
2
2
  export default mitt();
@@ -1,19 +1,19 @@
1
- // 读
2
- export function getCacheValueByKey(key) {
3
- return localStorage.getItem(key);
4
- }
5
-
6
- // 写
7
- export function setCacheValueByKey(key, val) {
8
- localStorage.setItem(key, val);
9
- }
10
-
11
- //删除
12
- export function removeCacheByKey(key) {
13
- localStorage.removeItem(key);
14
- }
15
-
16
- // 清除所有缓存
17
- export function clearCache() {
18
- localStorage.clear()
1
+ // 读
2
+ export function getCacheValueByKey(key) {
3
+ return localStorage.getItem(key);
4
+ }
5
+
6
+ // 写
7
+ export function setCacheValueByKey(key, val) {
8
+ localStorage.setItem(key, val);
9
+ }
10
+
11
+ //删除
12
+ export function removeCacheByKey(key) {
13
+ localStorage.removeItem(key);
14
+ }
15
+
16
+ // 清除所有缓存
17
+ export function clearCache() {
18
+ localStorage.clear()
19
19
  }
@@ -1,7 +1,7 @@
1
- // 返回这些错误码都要清除cookie及local storage
2
- //未登录 错误码
3
- const NEED_LOGIN = Number(import.meta.env.VITE_NEED_LOGIN_CODE)
4
-
5
- export const NEED_LOGIN_CODES = [
6
- NEED_LOGIN,
1
+ // 返回这些错误码都要清除cookie及local storage
2
+ //未登录 错误码
3
+ const NEED_LOGIN = Number(import.meta.env.VITE_NEED_LOGIN_CODE)
4
+
5
+ export const NEED_LOGIN_CODES = [
6
+ NEED_LOGIN,
7
7
  ]
@@ -1,20 +1,20 @@
1
- import * as ToastUtil from './toast_util'
2
-
3
- function evaluateWithParams(express, obj) {
4
- const objStr = JSON.stringify(obj);
5
- const newExpress = `(function() { const form = ${objStr}; return ${express}; })()`;
6
- console.log('表达式:'+newExpress)
7
- return eval(newExpress);
8
- }
9
-
10
- export const executeExpress = (express, params) => {
11
- try {
12
- const result = evaluateWithParams(express, params);
13
- console.log(result);
14
- return result
15
- } catch (e) {
16
- console.log('解析表达式失败', e)
17
- ToastUtil.warnToast('解析表达式失败 '+ e)
18
- return false
19
- }
1
+ import * as ToastUtil from './toast_util'
2
+
3
+ function evaluateWithParams(express, obj) {
4
+ const objStr = JSON.stringify(obj);
5
+ const newExpress = `(function() { const form = ${objStr}; return ${express}; })()`;
6
+ console.log('表达式:'+newExpress)
7
+ return eval(newExpress);
8
+ }
9
+
10
+ export const executeExpress = (express, params) => {
11
+ try {
12
+ const result = evaluateWithParams(express, params);
13
+ console.log(result);
14
+ return result
15
+ } catch (e) {
16
+ console.log('解析表达式失败', e)
17
+ ToastUtil.warnToast('解析表达式失败 '+ e)
18
+ return false
19
+ }
20
20
  }
@@ -1,37 +1,37 @@
1
- import { reactive } from 'vue'
2
- // 引入全部图标
3
- import * as Icons from "@element-plus/icons-vue"
4
-
5
- // 按需引入图标
6
- // import {
7
- // CloseBold,
8
- // Close,
9
- // Plus,
10
- // Star,
11
- // UserFilled,
12
- // Loading,
13
- // Connection,
14
- // Edit,
15
- // FolderOpened
16
- // } from '@element-plus/icons'
17
-
18
- // const dictIcon = reactive({
19
- // 'CloseBold': CloseBold,
20
- // 'Close': Close,
21
- // 'Plus': Plus,
22
- // 'Star': Star,
23
- // 'UserFilled': UserFilled,
24
- // 'Loading': Loading,
25
- // 'Connection': Connection,
26
- // 'Edit': Edit,
27
- // 'FolderOpened': FolderOpened
28
- // })
29
-
30
- const installIcon = (app) => {
31
- // 便于模板获取
32
- //app.config.globalProperties.$icon = dictIcon
33
- // 使用全部图标
34
- app.config.globalProperties.$icon = Icons
35
- }
36
-
1
+ import { reactive } from 'vue'
2
+ // 引入全部图标
3
+ import * as Icons from "@element-plus/icons-vue"
4
+
5
+ // 按需引入图标
6
+ // import {
7
+ // CloseBold,
8
+ // Close,
9
+ // Plus,
10
+ // Star,
11
+ // UserFilled,
12
+ // Loading,
13
+ // Connection,
14
+ // Edit,
15
+ // FolderOpened
16
+ // } from '@element-plus/icons'
17
+
18
+ // const dictIcon = reactive({
19
+ // 'CloseBold': CloseBold,
20
+ // 'Close': Close,
21
+ // 'Plus': Plus,
22
+ // 'Star': Star,
23
+ // 'UserFilled': UserFilled,
24
+ // 'Loading': Loading,
25
+ // 'Connection': Connection,
26
+ // 'Edit': Edit,
27
+ // 'FolderOpened': FolderOpened
28
+ // })
29
+
30
+ const installIcon = (app) => {
31
+ // 便于模板获取
32
+ //app.config.globalProperties.$icon = dictIcon
33
+ // 使用全部图标
34
+ app.config.globalProperties.$icon = Icons
35
+ }
36
+
37
37
  export default installIcon
@@ -1,28 +1,28 @@
1
- import Compressor from 'compressorjs'
2
-
3
- // 图片压缩
4
- export const compress_image = async (file) => {
5
- return new Promise((resolve, reject) => {
6
- new Compressor(file, {
7
- quality: 0.7,
8
- maxWidth: 1400,
9
- maxHeight: 1400,
10
- success(result) {
11
- console.log('压缩后的图片', result);
12
- let compress_file = blob2file(result, result.name)
13
- return resolve(compress_file)
14
- },
15
- error(err) {
16
- console.error(err);
17
- return reject(err)
18
- }
19
- })
20
- })
21
- }
22
-
23
- function blob2file(blob, fileName, fileType = blob.type) {
24
- return new File([blob], fileName, {
25
- type: fileType,
26
- lastModified: new Date().getTime()
27
- });
1
+ import Compressor from 'compressorjs'
2
+
3
+ // 图片压缩
4
+ export const compress_image = async (file) => {
5
+ return new Promise((resolve, reject) => {
6
+ new Compressor(file, {
7
+ quality: 0.7,
8
+ maxWidth: 1400,
9
+ maxHeight: 1400,
10
+ success(result) {
11
+ console.log('压缩后的图片', result);
12
+ let compress_file = blob2file(result, result.name)
13
+ return resolve(compress_file)
14
+ },
15
+ error(err) {
16
+ console.error(err);
17
+ return reject(err)
18
+ }
19
+ })
20
+ })
21
+ }
22
+
23
+ function blob2file(blob, fileName, fileType = blob.type) {
24
+ return new File([blob], fileName, {
25
+ type: fileType,
26
+ lastModified: new Date().getTime()
27
+ });
28
28
  }
package/src/util/index.js CHANGED
@@ -1,56 +1,56 @@
1
- import * as ApiUtil from '@/api'
2
- import { successToast, warnToast } from './toast_util'
3
- import * as AuthUtil from './auth_util'
4
- import * as ArrayUtil from './array_util'
5
- import * as StrUtil from './str_util'
6
- import * as BoolUtil from './bool_util'
7
- import * as RouteUtil from './route_util'
8
- import * as TimeUtil from './time_util'
9
- import * as ToastUtil from './toast_util'
10
- import * as EvalUtil from './eval_util'
11
- import * as ImageUtil from './image_util'
12
- import * as TreeUtil from './tree_util'
13
-
14
- export default {
15
- ...AuthUtil,
16
- ...ArrayUtil,
17
- ...StrUtil,
18
- ...BoolUtil,
19
- ...RouteUtil,
20
- ...TimeUtil,
21
- ...ApiUtil,
22
- ...ToastUtil,
23
- ...EvalUtil,
24
- ...ImageUtil,
25
- ...TreeUtil,
26
-
27
- href(url) {
28
- window.location.href = url
29
- },
30
- hrefByNew(url) {
31
- window.open(url, '_blank')
32
- },
33
- gotoLogin() {
34
- let baseUrl = RouteUtil.getBaseUrl()
35
- window.location.href = baseUrl + '#/login'
36
- },
37
- gotoByNew(path, params) {
38
- const routeData = router.resolve({ path: path, query: params });
39
- window.open(routeData.href, '_blank')
40
- },
41
- warnToast(msg) {
42
- warnToast(msg)
43
- },
44
- successToast(msg) {
45
- successToast(msg)
46
- },
47
- isEmail(email) {
48
- return validateEmail(email)
49
- },
50
- isPhone(phone) {
51
- return validatePhone(phone)
52
- },
53
- scrollToTop() {
54
- document.documentElement.scrollTop = 0
55
- }
1
+ import * as ApiUtil from '@/api'
2
+ import { successToast, warnToast } from './toast_util'
3
+ import * as AuthUtil from './auth_util'
4
+ import * as ArrayUtil from './array_util'
5
+ import * as StrUtil from './str_util'
6
+ import * as BoolUtil from './bool_util'
7
+ import * as RouteUtil from './route_util'
8
+ import * as TimeUtil from './time_util'
9
+ import * as ToastUtil from './toast_util'
10
+ import * as EvalUtil from './eval_util'
11
+ import * as ImageUtil from './image_util'
12
+ import * as TreeUtil from './tree_util'
13
+
14
+ export default {
15
+ ...AuthUtil,
16
+ ...ArrayUtil,
17
+ ...StrUtil,
18
+ ...BoolUtil,
19
+ ...RouteUtil,
20
+ ...TimeUtil,
21
+ ...ApiUtil,
22
+ ...ToastUtil,
23
+ ...EvalUtil,
24
+ ...ImageUtil,
25
+ ...TreeUtil,
26
+
27
+ href(url) {
28
+ window.location.href = url
29
+ },
30
+ hrefByNew(url) {
31
+ window.open(url, '_blank')
32
+ },
33
+ gotoLogin() {
34
+ let baseUrl = RouteUtil.getBaseUrl()
35
+ window.location.href = baseUrl + '#/login'
36
+ },
37
+ gotoByNew(path, params) {
38
+ const routeData = router.resolve({ path: path, query: params });
39
+ window.open(routeData.href, '_blank')
40
+ },
41
+ warnToast(msg) {
42
+ warnToast(msg)
43
+ },
44
+ successToast(msg) {
45
+ successToast(msg)
46
+ },
47
+ isEmail(email) {
48
+ return validateEmail(email)
49
+ },
50
+ isPhone(phone) {
51
+ return validatePhone(phone)
52
+ },
53
+ scrollToTop() {
54
+ document.documentElement.scrollTop = 0
55
+ }
56
56
  }
@@ -1,71 +1,71 @@
1
- /**
2
- * 分钱转元,保留小数点后2位
3
- * @param value 调用过滤器时,调用的文本
4
- */
5
- export function cent2yuanByDot(value) {
6
- // 如果文本不存在,返回空字符
7
- // value === 0 ; !0 === true.
8
- if (!value) {
9
- return '0.00'
10
- }
11
-
12
- // 文本转化为 float
13
- const result = parseFloat(value) / 100;
14
-
15
- // 如果文本为 integer 类型的文本,表示当前文本没有小数
16
- // if (Number.isInteger(result)) {
17
- // return result
18
- // }
19
-
20
- // 文本包含小数,保留小数点后2位
21
- return result.toFixed(2);
22
- }
23
-
24
- /**
25
- * 分钱转元,不保留角、分
26
- * @param value 调用过滤器时,调用的文本
27
- */
28
- export function cent2yuan(value) {
29
- // 如果文本不存在,返回空字符
30
- // value === 0 ; !0 === true.
31
- if (!value) {
32
- return '0.00'
33
- }
34
-
35
- // 文本转化为 float
36
- const result = parseFloat(value) / 100;
37
-
38
- // 如果文本为 integer 类型的文本,表示当前文本没有小数
39
- // if (Number.isInteger(result)) {
40
- // return result
41
- // }
42
-
43
- // 文本包含小数,保留小数点后2位
44
- return result.toFixed(0);
45
- }
46
-
47
- export function num2boolean(value) {
48
- if (value > 0)
49
- return true
50
- else
51
- return false
52
- }
53
-
54
- export function percent(value) {
55
- // 如果文本不存在,返回空字符
56
- // value === 0 ; !0 === true.
57
- if (!value) {
58
- return '0.00'
59
- }
60
-
61
- // 文本转化为 float
62
- const result = parseFloat(value) * 100;
63
-
64
- // 如果文本为 integer 类型的文本,表示当前文本没有小数
65
- // if (Number.isInteger(result)) {
66
- // return result
67
- // }
68
-
69
- // 文本包含小数,保留小数点后2位
70
- return result.toFixed(2);
1
+ /**
2
+ * 分钱转元,保留小数点后2位
3
+ * @param value 调用过滤器时,调用的文本
4
+ */
5
+ export function cent2yuanByDot(value) {
6
+ // 如果文本不存在,返回空字符
7
+ // value === 0 ; !0 === true.
8
+ if (!value) {
9
+ return '0.00'
10
+ }
11
+
12
+ // 文本转化为 float
13
+ const result = parseFloat(value) / 100;
14
+
15
+ // 如果文本为 integer 类型的文本,表示当前文本没有小数
16
+ // if (Number.isInteger(result)) {
17
+ // return result
18
+ // }
19
+
20
+ // 文本包含小数,保留小数点后2位
21
+ return result.toFixed(2);
22
+ }
23
+
24
+ /**
25
+ * 分钱转元,不保留角、分
26
+ * @param value 调用过滤器时,调用的文本
27
+ */
28
+ export function cent2yuan(value) {
29
+ // 如果文本不存在,返回空字符
30
+ // value === 0 ; !0 === true.
31
+ if (!value) {
32
+ return '0.00'
33
+ }
34
+
35
+ // 文本转化为 float
36
+ const result = parseFloat(value) / 100;
37
+
38
+ // 如果文本为 integer 类型的文本,表示当前文本没有小数
39
+ // if (Number.isInteger(result)) {
40
+ // return result
41
+ // }
42
+
43
+ // 文本包含小数,保留小数点后2位
44
+ return result.toFixed(0);
45
+ }
46
+
47
+ export function num2boolean(value) {
48
+ if (value > 0)
49
+ return true
50
+ else
51
+ return false
52
+ }
53
+
54
+ export function percent(value) {
55
+ // 如果文本不存在,返回空字符
56
+ // value === 0 ; !0 === true.
57
+ if (!value) {
58
+ return '0.00'
59
+ }
60
+
61
+ // 文本转化为 float
62
+ const result = parseFloat(value) * 100;
63
+
64
+ // 如果文本为 integer 类型的文本,表示当前文本没有小数
65
+ // if (Number.isInteger(result)) {
66
+ // return result
67
+ // }
68
+
69
+ // 文本包含小数,保留小数点后2位
70
+ return result.toFixed(2);
71
71
  }