美文网首页
vue3.0 音频插件(vue-aplayer)

vue3.0 音频插件(vue-aplayer)

作者: AbelEthan | 来源:发表于2019-12-25 10:24 被阅读0次

上篇文章我们说了怎么使用 视频插件vue-vedio-player那么我们当然也有音频插件了

我们选择使用vue-aplayer

  • 同样我们先安装这个插件

npm install vue-aplayer -s

  • 我们需要在main.js里面导入并引用
import vueAplayer from 'vue-aplayer'

Vue.use(vueAplayer)
image.gif
  • 那么我们怎么使用了?
  • 首先我们需要在使用的vue文件里面引入他
import aplayer from 'vue-aplayer'

export default {
    components: {
      aplayer
    }
}
image.gif
  • 我们的html部分
<template>
    <div style="width: 60%">
         <aplayer :music="videoUpload.music"></aplayer>
    </div>
</template>
image.gif
  • js部分
<script>
    export default {
        data() {
            return {
                videoUpload: {
                    progress: false,
                    progressPercent: 0,
                    successPercent: 0,
                    music: {
                       title: '',
                       author: '',
                       url: '',
                       lrc: '[00:00.00]lrc here\n[00:01.00]aplayer'
                   }
                },
            }
        }
    }
</script>
image.gif
  • 最后我们来看一下效果
image image.gif

相关文章

网友评论

      本文标题:vue3.0 音频插件(vue-aplayer)

      本文链接:https://www.haomeiwen.com/subject/jvaqoctx.html