vue使用音频组件

vue-aplayer中文文档:https://github.com/SevenOutman/vue-aplayer/blob/develop/docs/README.zh-CN.md

1、安装音频组件包vue-aplayer

yarn add vue-aplayer 或 npm install vue-aplayer --save

2、引入

import Aplayer from 'vue-aplayer'

new Vue({
    components: {
        Aplayer
    },
    data(){
        return{
            audioPlayerData: {
                title: '歌曲名',
                artist: '歌手',
                src: 'https://moeplayer.b0.upaiyun.com/aplayer/secretbase.mp3',
                pic: 'https://moeplayer.b0.upaiyun.com/aplayer/secretbase.jpg'
            }
        }
    }
})

3、使用

<aplayer class="audio-player" :music="audioPlayerData"></aplayer>

posted @ 2021-03-26 16:52  huihuihero  阅读(1744)  评论(0编辑  收藏  举报