|
@@ -34,11 +34,21 @@ export default {
|
|
|
default: () => ({})
|
|
|
},
|
|
|
// 默认的数据
|
|
|
- // 对象中必要参数又id与time
|
|
|
+ // 对象中必要参数又id
|
|
|
// 默认以text为展示内容,text可以是文本或者是返回文本的函数。没有则展示id
|
|
|
defaultBarrage: {
|
|
|
type: Array,
|
|
|
default: () => []
|
|
|
+ },
|
|
|
+ // 密集度,越大越密集
|
|
|
+ intensity: {
|
|
|
+ type: Number,
|
|
|
+ default: 3
|
|
|
+ },
|
|
|
+ // 是否固定间隔
|
|
|
+ isImmobilization: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -97,7 +107,6 @@ export default {
|
|
|
},
|
|
|
// 开始
|
|
|
start() {
|
|
|
- console.log(this.timeId, 'lllll')
|
|
|
if (this.timeId) {
|
|
|
clearTimeout(this.timeId)
|
|
|
}
|
|
@@ -107,15 +116,18 @@ export default {
|
|
|
}
|
|
|
|
|
|
// 上一个距离下一个的时间
|
|
|
- if (this.currentData.value.time) {
|
|
|
+ if (this.isImmobilization && this.currentData.value.time) {
|
|
|
var timenum = this.currentData.value.time
|
|
|
} else if (this?.currentData?.next === this.link?.head && document.getElementById(this.link?.head?.value?.id)) {
|
|
|
var timenum = Math.abs(this.wheelTime - Math.abs(new Date().getTime() - this.StartPointTime.getTime()))
|
|
|
} else {
|
|
|
- var timenum = this.getRandomIntInRange(0, this.wheelTime / 2)
|
|
|
+ var timenum = this.getRandomIntInRange(0, this.wheelTime / (this.intensity <= 0 ? 1 : this.intensity))
|
|
|
}
|
|
|
|
|
|
- this.currentData.value.time = timenum
|
|
|
+ // 记录间隔时间
|
|
|
+ if (this.isImmobilization) {
|
|
|
+ this.currentData.value.time = timenum
|
|
|
+ }
|
|
|
|
|
|
// 删除之前的
|
|
|
var node = document.getElementById(this.currentData?.value?.id)
|