开源地址:https://github.com/fdddf/vue3-aplayer
项目fork自 https://github.com/SevenOutman/vue-aplayer
适配vue3,需要vue3.0.7支持,更新了相关依赖。
安装方式:
npm i vue3-aplayer
使用方法:
<aplayer ref="audioPlayer" autoplay :music="playingItem" :volume="1" @error="showPlayError" />
import aplayer from 'vue3-aplayer'
export default {
components: { aplayer },
...
methods: {
handlePlay(row) {
this.playingItem = {
title: row.title || '-',
artist: row.artist || 'unknown',
src: row.path,
pic: row.album
}
},
}
}