Vue中使用把汉字转化为拼音字母 | 您所在的位置:网站首页 › 把汉字转换成拼音大写 › Vue中使用把汉字转化为拼音字母 |
源码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 实验室设备网 版权所有 |