vue中实现汉字转化拼音

Posted web-gmy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue中实现汉字转化拼音相关的知识,希望对你有一定的参考价值。

1、npm i js-pinyin

2、import Pinyin from "js-pinyin";

3、API

 console.log(pinyin.getFullChars('管理员'));    //GuanLiYuan
    console.log(pinyin.getCamelChars('管理员'));    //GLY
    console.log(pinyin.getCamelChars('1234'));    //1234
    console.log(pinyin.getCamelChars('english'));    //english

以上是关于vue中实现汉字转化拼音的主要内容,如果未能解决你的问题,请参考以下文章