hcui-package 2.0.52 → 2.0.54

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.
@@ -82,3 +82,14 @@ export const handleSavePrice = (value, fixed = 2) => {
82
82
  }
83
83
  return negative ? '-' + result : result;
84
84
  }
85
+
86
+ export const returnWidthMap = (title) => {
87
+ let result = 100
88
+ const count = title.replace(/[^\u4e00-\u9fa5]/g, '').length
89
+ const otherCount = title.replace(/[\u4e00-\u9fa5]/g, '').length
90
+
91
+ // 根据字符串title中汉字的数量来确定输入框的宽度 规则为每个汉字占15px 符号占7px
92
+ result = count * 15 + otherCount * 7
93
+
94
+ return result + 42
95
+ }