function getFirstPinyin(value) { return window.pinyinUtil.getFirstLetter(value, true).join(''); } function getFirstPinyin2(str) { var _ = YvanUI.lodash; var result = []; if (!str) { return ''; } for (var i = 0; i < str.length; i++) { var unicode = str.charCodeAt(i); var ch = str.charAt(i); if (unicode >= 19968 && unicode <= 40869) { //@ts-ignore result.push(getFirstPinyin(ch)); } else { result.push(_.toUpper(ch)); } } return result.join(""); }