0.3.5 • Published 9 months ago

minivuebarrage v0.3.5

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

minivueBarrage

Version description(版本说明)

npm版本

8.5.1 node 版本

node": ">=6.11.5"

中文文档

1689842440686

如何使用 ? (How to use it?)

vue2

npm i minivuebarrage 

yarn add minivuebarrage

Description(描述)

minivueBarrage is a barrage component developed with the vue framework. It provides barrage resetting, opening, closing and pausing full screen, customizing ICONS, and defining user-published barrage styles, speed colors, and more

Usage(使用)

This plugin can help you quickly create a pop-up view container, you can specify operations on it, such as pause, reset, open, close and so on, let's see how to use it

main.js

//全局组件
import miniVueBarrage from 'minivuebarrage'
import 'minivuebarrage/lib/mini-vue-barrage.css'
import Vue from 'vue'

Vue.use(miniVueBarrage)

or

// 局部组件
import { miniVueBarrage } from "minivuebarrage";
import "minivuebarrage/lib/mini-vue-barrage.css";

components

当前弹幕的类名 可根据类名绑定样式<template>
  <div class="Home">
    <miniVueBarrage class="barrages-ctn" ref='barrage' fullScreen :definStyle='myStyle' :barrages="barrages" />
  </div>
</template>
<script>
export default {
  name: "Home",
  data() {
    return {
        barrages: [{
            content:"Michelle Young", // 弹幕内容
            id:"110000200606013327", // 弹幕id
            type:"common", // 弹幕类型
            url:"", // 决定你跳转的页面 
            delay : 5, // 决定你弹幕的运行速度 单位为 s
            className : ‘’, // 当前弹幕的类名 可根据类名绑定样式
            Icon : '', // 支持 http 链接 or base64字符串 弹幕的icon 默认为 VueIcon
        }]
    };
  },
    computed: {
        myStyle(){
            return { border : '1px solid red' }
        }
    }  
};
</script>
字段(fields)类型(type)是否必填(require)描述(desc)
contentstringtrue弹幕内容
idnumbertrue弹幕id
typestringtrue弹幕类型
urlstringfalse决定你跳转的页面
classNamestringfalse当前弹幕的类名
Iconstringfalse弹幕的icon 支持 http 链接 or base64字符串 弹幕的icon 默认为 VueIcon

详解:

className : 如果你需要给特殊类型的弹幕进行样式定制,那你只需要给当前这条弹幕传入类名,我们会自动绑定该类,你可以在组件外部尽情的更改样式,也许它会对你有帮助(If you need to style a particular type of screen, just pass in the class name for the current screen, we will automatically bind the class, you can change the style outside the component as much as you like, maybe it will help you)

Icon : 如果你需要给弹幕绑定Icon小图标,那你可以在当前弹幕对象中添加该属性,我会帮助你完成渲染,也许它会对你有帮助(If you need to attach a small Icon to a bullet screen, then you can add this property to the current bullet screen object, I will help you finish rendering, maybe it will help you)

高级用法

我们对该组件实例本身暴露了以下几个方法(We exposed the following methods to the component instance itself.)。

字段(fields)组件实例typedesc
add实例本身即可调用function(barrageItme){}添加弹幕
reset实例本身即可调用function(){}重置弹幕
pause实例本身即可调用function(){}暂停弹幕
close实例本身即可调用function(){}关闭弹幕
play实例本身即可调用function(){}开启运行弹幕
changeColor实例本身即可调用function(color : string){}更改弹幕颜色

add

  add(e) {
      // this.value 代表输入的弹幕值
      if (!this.value.trim()) return;
      this.$refs.barrage.add({
        content: this.value
      });
      this.value = "";
    },

changeColor

 changeColor() {
      // this.color 代表选择的颜色字符串 比如:'#000000'
      this.$refs.barrage.changeColor(this.color);
 }

close

 close() {
      this.$refs.barrage.close();
 }	,

参数列表(Parameter list)

propstypedefaultisRrquiredesc
barragesArray | [][]true弹幕数组
rowsNumber8false弹幕的弹道 ,可使每条弹幕在对应的弹道中 不重复 叠加
fullScreenBooleanfalsefalse你是否需要全屏弹幕
createTimeNumber1sfalse你希望每多少秒创建一次弹幕
delayNumber8sfalse你希望弹幕需要多少秒滚动一屏,弹幕文组滑过容器的时间
isBatchDestoryBooleanfalsefalse是否需要批量销毁弹幕
batchDestoryNumNumber10false每次批量销毁的弹幕数量
definStyleObject{}false用户自己发布的弹幕的样式,可配置
jumpLinkFlagBooleanfalsefalse是否需要点击链接后跳转页面
0.3.5

9 months ago

0.3.4

9 months ago

0.3.3

10 months ago

0.3.2

10 months ago

0.3.1

10 months ago

0.3.0

10 months ago

0.2.9

10 months ago

0.2.8

10 months ago

0.2.7

10 months ago

0.2.6

10 months ago

0.2.5

10 months ago

0.2.4

10 months ago

0.2.3

10 months ago

0.2.2

10 months ago

0.2.0

10 months ago

0.1.0

10 months ago