2 Star 13 Fork 1

SevensChan / vue-baberrage

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README


VueBaberrage

Barrage plugin for Vue.js.

OverviewOverviewDemoInstallationUsagePlug OptionsRoadmap

Introduction

Baberrage is one of the popular comment perform style in China.

Overview

new_version

GIF performance is not good enough. Please refer to DEMO page

中文文档

Demo

See the DEMO page

Installation

  1. Install package via NPM
npm i vue-baberrage
  1. Install plugin within project
import Vue from 'vue'
import { vueBaberrage } from 'vue-baberrage'
Vue.use(vueBaberrage)

or

const vueBaberrage = request('vue-baberrage').vueBaberrage

or

<script src="./dist/vue-baberrage.js"></script>

Usage

  1. Template isShow and barrageList are necessary.
<div id="app">
<vue-baberrage
      :isShow= "barrageIsShow"
      :barrageList = "barrageList"
      :loop = "barrageLoop"
      >
    </vue-baberrage>
</div>
  1. Script
import { MESSAGE_TYPE } from 'vue-baberrage'

export default {
  name: 'app',
  data () {
    return {
      msg: 'Hello vue-baberrage',
      barrageIsShow: true,
      currentId : 0,
      barrageLoop: false,
      barrageList: []
    }
  },  
  methods:{
    addToList (){
      this.barrageList.push({
        id: ++this.currentId,
        avatar: "./static/avatar.jpg",
        msg: this.msg,
        time: 5,
        type: MESSAGE_TYPE.NORMAL
      });
  ...
  1. Already done

Just two step, and add new barrage message by pushing data into the barrageList. You needn't concern about the management of the barrageList, it will be handled by vue-baberrage. Suggest the barrageList store into the Vuex.

Plugin Options

isShow

- Default: `true`
- Acceptable-Values: Boolean
- Function: This is the switch that if barrage is displayed.

barrageList

- Default: `[]`
- Acceptable-Values: Array
- Function: The is the container for managing the all barrage messages.

boxWidth

- Default: `parent's Width`
- Acceptable-Values: Number
- Function: Determine the width of the stage.

boxHeight

- Default: `window's Height`
- Acceptable-Values: Number
- Function: Determine the height of the stage.

messageHeight

- Default: `message's Height`
- Acceptable-Values: Number
- Function: Determine the height of the message.

maxWordCount

- Default: 60
- Acceptable-Values: Number
- Function: Determine the word count of the message.

loop

- Default: `false`
- Acceptable-Values: Boolean
- Function: Loop or not.

throttleGap

- Default: 2000
- Acceptable-Values: Number
- Function: The gap time between the message

Barrage Message Options

id

- Default: `null`
- Acceptable-Values: Number
- Function: For distinguish with other barrage messages.

avatar

- Default: `#`
- Acceptable-Values: String
- Function: Show the avatar of the barrage message.

msg

- Default: `null`
- Acceptable-Values: String
- Function: The content of the barrage message.

barrageStyle

- Default: `normal`
- Acceptable-Values: String
- Function: the css class name of the barrage message.

time

- Default: `10`
- Acceptable-Values: Number
- Function: How long does the barrage message show.(Seconds)

type

- Default: MESSAGE_TYPE.NORMAL
- Acceptable-Values: Symbol
- Function: The type of the barrage message. 
			MESSAGE_TYPE.NORMAL for scroll from right to left. 
			MESSAGE_TYPE.FROM_TOP for fixed on the top of the stage.

Events

barrage-list-empty when the barrageList is empty will be called.

<vue-baberrage
	      :is-show= "barrageIsShow"
	      :barrage-list = "barrageList"
	      :loop = "barrageLoop"
	      @barrage-list-empty="sayHi"
	      >

Roadmap

Version 0.0.1

  • Realized the basic functionality.

Version 1.0.0

  • Performance improvement.

Version 1.2.0

  • Code specification
  • Performance improvement.

Version 2.1.2

  • Using ES6.
  • Performance improvement.

Future

I am developing Vue-Baberrage-Plus, difference between Vue-Barrage and Vue-Baberrage-Plus is former will be used for a tool, and Plus is a baberrage system.

空文件

简介

Barrage plugin for Vue.js. 基于Vue.js弹幕插件. 展开 收起
JavaScript
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/hoseapps/vue-baberrage.git
git@gitee.com:hoseapps/vue-baberrage.git
hoseapps
vue-baberrage
vue-baberrage
master

搜索帮助