Skip to content

Commit

Permalink
[all]: Only import the pinyin function from pinyin-pro
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrRip committed Dec 24, 2024
1 parent 8a07e57 commit d3bf224
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/admin/app/pages/playlist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ async function viewPlaylistDataSort (data: Playlist, column: PlaylistColumn, ord

// Sort by song name or artist in alphabetical order
if (column === 'name' || column === 'artist') {
const pinyinPro = await import('pinyin-pro')
const { pinyin } = await import('pinyin-pro')
playlist.forEach((song, index) => {
// @ts-expect-error
playlist[index][`${column}Pinyin`] =
// @ts-expect-error
pinyinPro.pinyin(song[column], { toneType: 'none', nonZh: 'consecutive' })
pinyin(song[column], { toneType: 'none', nonZh: 'consecutive' })
.replaceAll(' ', '')
})
playlist.sort((a, b) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/home/app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ async function viewPlaylistDataSort (data: Playlist, column: PlaylistColumn, ord

// Sort by song name or artist in alphabetical order
if (column === 'name' || column === 'artist') {
const pinyinPro = await import('pinyin-pro')
const { pinyin } = await import('pinyin-pro')
playlist.forEach((song, index) => {
// @ts-expect-error
playlist[index][`${column}Pinyin`] =
// @ts-expect-error
pinyinPro.pinyin(song[column], { toneType: 'none', nonZh: 'consecutive' })
pinyin(song[column], { toneType: 'none', nonZh: 'consecutive' })
.replaceAll(' ', '')
})
playlist.sort((a, b) => {
Expand Down

0 comments on commit d3bf224

Please sign in to comment.