wkjp-list-page 1.0.36 → 1.0.37

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wkjp-list-page",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "Vue2 + ElementUI CommonListPage component",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -770,22 +770,44 @@ export default {
770
770
  // 英文字母/数字:超过40个字符宽度单位(约40个英文字母/数字)
771
771
  shouldShowOverflowTooltip(text) {
772
772
  var str = String(text == null ? "" : text);
773
+
774
+ // 如果字符串为空,不显示省略号
775
+ if (str.length === 0) {
776
+ return false;
777
+ }
778
+
773
779
  var fullWidthCount = 0; // 全角字符计数
774
780
  var halfWidthCount = 0; // 半角字符计数
781
+ var isPureNumberOrLetter = true; // 标记是否为纯数字或字母
775
782
 
776
783
  for (var i = 0; i < str.length; i++) {
777
784
  var charCode = str.charCodeAt(i);
785
+ var char = str.charAt(i);
786
+
787
+ // 检查是否为全角字符
778
788
  if (
779
789
  (charCode >= 0x4E00 && charCode <= 0x9FFF) || // 中文
780
790
  (charCode >= 0x3000 && charCode <= 0x303F) || // CJK符号和标点
781
791
  (charCode >= 0xFF00 && charCode <= 0xFFEF) // 全角字符
782
792
  ) {
783
793
  fullWidthCount++;
794
+ isPureNumberOrLetter = false; // 包含全角字符,不是纯数字/字母
784
795
  } else {
785
796
  halfWidthCount++;
797
+ // 检查是否为数字或字母(半角)
798
+ if (!((charCode >= 48 && charCode <= 57) || // 数字 0-9
799
+ (charCode >= 65 && charCode <= 90) || // 大写字母 A-Z
800
+ (charCode >= 97 && charCode <= 122))) { // 小写字母 a-z
801
+ isPureNumberOrLetter = false; // 包含非数字字母字符
802
+ }
786
803
  }
787
804
  }
788
805
 
806
+ // 纯数字或字母内容不显示省略号
807
+ if (isPureNumberOrLetter && halfWidthCount > 0 && fullWidthCount === 0) {
808
+ return false;
809
+ }
810
+
789
811
  // 计算总宽度单位:全角字符*2 + 半角字符*1
790
812
  var totalWidth = fullWidthCount * 2 + halfWidthCount;
791
813