Skip to content

airzhanglin/wechatPlayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wechatplayer

写了一个类似于微信公众号网页播放器 此处输入图片的描述

Install

npm install wechatplayer -S

Usage

import wechatPlayer from 'wechatplayer'

export default {
  components: {
    wechatPlayer
  }
}

Props

名称 类型 默认值 说明
playerid String audio-player 定义播放器的id
url String 播放地址
title String 音乐名称
autoplay Boolean false 是否自动播放(移动端无法自动播放)
styleObject Object { width: "289px", height: "71px"} 播放器大小和其他自定义样式

Method

名称 参数 描述
play none 播放
pause none 暂停

Example:

<wechat-player ref="wechaplayer"></wechat-player>
<button @click="play">播放</button>

export default {
    methods: {
      play() {
        this.$refs.wechaplayer.play();
      }
    }

Events

名称 参数 描述
play none 播放
pause none 暂停
canplay none 可以播放
error none 播放失败
ended none 播放完毕

Example:

<wechat-player @play="play"></wechat-player>

export default {
    methods: {
      play() {
        console.log('play callback')
      }
    }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published