vue 中文轉(zhuǎn)拼音

安裝:
npm install js-pinyin --save
在 script 引入:
let pinyin = require('js-pinyin');
methods:
getTitle(title) { const py = pinyin.getFullChars(title) return py.replace(/[^0-9a-zA-Z]/g, ''); },
template:
<div class="titlePingyin">{{ getTitle(items.SYS_TOPIC) }}</div>
getFullChars:拼音全稱
getCamelChars:保留首字母大寫

浙公網(wǎng)安備 33010602011771號(hào)