vue 汉字转首字母
时间:2020-11-27 15:35:13
收藏:0
阅读:380
首先安装
npm install js-pinyin --save
引入
import pinyin from ‘js-pinyin‘
使用案例
let name = ‘小明‘
let char = ‘‘
pinyin.setOptions({checkPolyphone:false,charCase:0});
char = pinyin.getCamelChars(this.name)
// char = XM
github地址:https://github.com/waterchestnut/pinyin
原文:https://www.cnblogs.com/xiaozhenoh/p/14047960.html
评论(0)