Barrage 弹幕
#13060
Replies: 2 comments
-
const createBarrageItem = (
text: string | number,
delay: number = props.delay,
) => {
const item = document.createElement('span');
item.className = className;
item.innerText = String(text);
item.style.animationDuration = `${props.duration}ms`;
item.style.animationDelay = `${delay}ms`;
item.style.animationName = 'van-barrage';
item.style.animationTimingFunction = 'linear';
return item;
}; |
Beta Was this translation helpful? Give feedback.
0 replies
-
如果要设计的话,怎么去定义这个item,通过插槽还是通过一个新的组件 <van-barrage v-model="list">
<div class="video">
</div>
<template #item="{item}">
<h1>1{{item.text}}</h1>
</template>
</van-barrage> 方案二: <van-barrage v-model="list">
<van-barrage-item v-for="item in list" :key="item.id">
{{ item.text }}
</van-barrage-item>
</van-barrage> 感觉使用插槽更加灵活,不会局限于 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
弹幕组件现有开放插槽支持添加头像吗
Beta Was this translation helpful? Give feedback.
All reactions