直播源码开发,vue汉字获取字母首拼或拼音、大小写
1.npm安装
npm install js-pinyin
2.使用示例( charCase: 0 为大写;charCase: 1 为小写)
若不设置则默认为 charCase: 0
let pinyin = require("js-pinyin");
pinyin.setOptions({ checkPolyphone: false, charCase: 1 });
console.log(pinyin.getCamelChars('小明')); //xm
console.log(pinyin.getFullChars('博客'));//BoKe
以上就是直播源码开发,vue汉字获取字母首拼或拼音、大小写, 更多内容欢迎关注之后的文章