word-pinyin
Node端汉字转拼音库, 针对小程序设计, 不支持多音字
安装
yarn add word-pinyin
例子
; PinYin // ni hao sao aPinYin // NHSA
方法
getPinyin(chinese: string, splitter: string = ' ') 获取汉字的拼音
- cinese: 汉字
- splitter: 字与字之间的分隔符
getFirstLetter(str: string) 获取汉字的拼音首字母
- str: 汉字