javascript - How to use vue to implement rolling update of data traversed by v-for (one piece of data every 6 seconds)
仅有的幸福
仅有的幸福 2017-05-19 10:33:36
0
2
676

 moveUp: function(result){
                var self =this,timer,circleTime=0;
                var _result=result;
                timer = setInterval(function(){
                   self.goHtml(_result[circleTime]);
                   circleTime++;
                },6000);
            },
            goHtml: function(val){
                return val;
            }

The value returned by v-html is empty, with nothing. Because the info in the goodsList has not changed during the traversal, the data will not be rendered to the DOM node. How to solve the problem? (Attachment: The first picture is shown without the moveUp method for everyone to see)

仅有的幸福
仅有的幸福

reply all(2)
Peter_Zhu

html

<p id="app">
    <ul>
        <li
                v-show='item == current'
                v-for='item in arr'>{{item}}
        </li>
    </ul>
</p>

js

 new Vue({
        el: "#app",
        data: {
            arr: [1, 2, 3, 4, 5, 6],
            current: 1
        },
        created(){
            setInterval(() => {
                this.current++
            }, 1000)
        }
    })

Provide an idea. . .

洪涛

v-for="(index,info) in goods.listId" Is it written backwards?

Info should be in the front and index in the back

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template