Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

< 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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report