2
一個新的動畫事件我有被填充的清單,但一旦達到一定的長度,我想改變動畫類,並從陣列中移除該項目觸發與wowjs和VUE
<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()
}
}
我沿着相同的路線思考和這真的清除它,謝謝! – Dazzle