我有一个正在填充的列表,但是一旦达到一定长度,我想更改动画类并从数组中删除该项目
<ul id="myList">
<li v-for="item in myItems">
// each item will slide in
<div class="box wow slideInRight">
<p style="color: black;">@{{ item }}<p>
</div>
</li>
</ul>
watch: {
'myItems'() {
if(this.myItems.length > 2) {
// get the first item
var div = document.getElementsByTagName('ul')[0].children[0].children[0];
// Change class name
div.className = 'box wow fadeOutLeft';
// Must also change style
div.style.animationName = 'fadeOutLeft';
**// how to trigger the new class ?**
// this will trigger all of the classes again, but I just want the first item in the list. Can I select one element?
new WOW().init();
// remove first item from the array
this.myItems.shift()
}
}