中文转拼音
作者:
随行者pgl | 来源:发表于
2022-04-08 15:29 被阅读0次1. 安装
js-pinyin npm地址
npm install js-pinyin --save
2. 引入及使用
<script>
const pinyin = require('js-pinyin');
export default {
methods: {
test(){
console.log( pinyin.getFullChars('明天也要努力') ); // MingTianYeYaoNuLi
console.log( pinyin.getCamelChars('明天也要努力') ); // MTYYNL
console.log( pinyin.getCamelChars('12明天也要努力34') ); // 12MTYYNL34
console.log( pinyin.getCamelChars('a明天也要努力b') ); // aMTYYNLb
}
},
mounted(){
this.test();
}
}
</script>
本文标题:中文转拼音
本文链接:https://www.haomeiwen.com/subject/kneysrtx.html
网友评论