Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the pinyin conversion plug-in in a vue project

Shulou Source: shulou.com Published: 2022-06-01 01:38:50 09月21日 Update

< l2; i++) { var val = l1.substr(i, 1) var name = this.arraySearch(val, pinyin) if (reg.test(val)) { I1 += val } else if (name !== false) { I1 += name } } I1 = I1.replace(/ /g, '-') while (I1.indexOf('--') >

0) {I1 = I1.replace ('- -','-')} return I1}, arraySearch: function (L1) {for (var name in pinyin) {if (pinyin [name] .indexOf (L1)! =-1) {return this.ucfirst (name)}} return false}, ucfirst: function (L1) {if (l1.length > 0) {var first = l1.substr (0,1). ToUpperCase () var spare = l1.substr (1) L1.length) return first + spare}} 3. The project uses # to introduce the Chinese character conversion pinyin plug-in file import vPinyin from'.. / utils/vue-py'let salesmanName = 'Zhang San' # call the Chinese character conversion pinyin method let namePinyin = vPinyin.chineseToPinYin (salesmanName) above is all the content of this article "how to use the pinyin conversion plug-in in the vue project". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Plug-ins pinyin files knowledge articles Chinese characters projects content administrators management different big functional most that is ways methods more knowledge points industries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS MariaDB Apple Shulou Technology