| | |
| | | import { filterMultiDictText } from '/@/utils/dict/JDictSelectUtil.js'; |
| | | import { isEmpty } from '/@/utils/is'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import pinyin from 'chinese-to-pinyin'; |
| | | |
| | | const { createMessage } = useMessage(); |
| | | |
| | | const render = { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取中文字符串的全拼 |
| | | * @param str 中文字符串 |
| | | * @returns 拼音字符串 |
| | | */ |
| | | export function getFullWordSpell(str: string): string { |
| | | if (!str) return ''; |
| | | return pinyin(str, { toneToNumber: true }); |
| | | } |
| | | |
| | | /** |
| | | * 获取中文字符串的首字母 |
| | | * @param str 中文字符串 |
| | | * @returns 首字母组成的字符串 |
| | | */ |
| | | export function getFirstWordSpell(str: string): string { |
| | | if (!str) return ''; |
| | | // 获取每个字的拼音首字母并连接 |
| | | return pinyin(str, { keepRest: true, firstCharacter: true, removeSpace: true }); |
| | | } |
| | | |
| | | export { render, downloadFile }; |