效果图
FlashMarker组件使用
引入
import Vue from 'vue'
import {FlashMarker} from 'special-ui'
Vue.use(FlashMarker)
使用
<template>
<div class="container">
<flash-marker :width="1920" :height="1080" :dataset="dataset" @clickIndex="clickIndex"/>
</div>
</template>
<script>
export default {
data () {
return {
dataset: [
{
position: {x: 300, y: 300},
color: '#5070FF',
type: 'circle',
speed: 0.2
},
{
position: {x: 350, y: 300},
color: '#6EE7FF',
type: 'ellipse',
speed: 0.3,
max: 40,
},
{
position: {x: 400, y: 300},
color: '#90EE90',
type: 'circle',
speed: 0.45,
}, {
position: {x: 950, y: 300},
color: '#f8983a',
type: 'circle',
speed: 0.9,
max: 100,
},
{
position: {x: 700, y: 300},
color: '#FAFA32',
type: 'ellipse',
speed: 1,
max: 100,
}
]
}
},
methods: {
clickIndex (index) {
console.log(index)
}
}
}
</script>
<style lang="scss" scoped>
.container {
height: 100%;
}
</style>
组件参数
属性 | 说明 | 默认值 |
---|---|---|
dataset | 数据 | [] |
width | 画布宽度 | 0, 必传 |
height | 画布高度 | 0, 必传 |
zIndex | 视图层级 | 0 |
dataset数据项说明:
position: 动效中心坐标点;
color: 动效颜色;
type: 动效类型(circle | ellipse), 默认circle;
max: 动效最大范围, 默认20;
speed: 动效速度, 越大越快, 默认0.15