Vue中使用把汉字转化为拼音字母 您所在的位置:网站首页 把汉字转换成拼音大写 Vue中使用把汉字转化为拼音字母

Vue中使用把汉字转化为拼音字母

2024-07-14 13:20| 来源: 网络整理| 查看: 265

源码git地址:

https://github.com/waterchestnut/pinyin.git

 

安装:

npm install js-pinyin import pinyin from 'js-pinyin'

 

使用示例 let pinyin = require('js-pinyin'); pinyin.setOptions({checkPolyphone: false, charCase: 0}); console.log(pinyin.getFullChars('管理员')); console.log(pinyin.getCamelChars('管理员')); console.log(pinyin.getCamelChars('1234')); console.log(pinyin.getCamelChars('english'));

 

程序中调用:

            

              

            

 

method中增加调用方法:

 methods: {

    createpy()

    {

        let pinyin = require('js-pinyin');

        pinyin.setOptions({checkPolyphone: false, charCase: 0});

        this.form.NamePy=pinyin.getCamelChars(this.form.Name);

    }

}



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有