javascript - Why does the Swipe plug-in in vue not re-update the dom after the value of data is updated?
習慣沉默
習慣沉默 2017-05-19 10:18:49
0
4
426

This is a banner image, a swipe carousel component written with vue.

This is the initial value passed in. Every time the page is loaded, the value will be fetched from the local storage. If there is any, it will be passed in directly. At the same time, it will go to the server to request news information, update this.news, and then restart Passing in the new value of the swipe component will not trigger the update of the dom, and the carousel pictures will remain the same. Why is this? The console prints out that the incoming news value has indeed changed. Shouldn't it trigger an update to the DOM in a responsive manner?

data(){
    return{
        news:localStorage.getItem("news")
    }
}
getSwipePictrue:function(){
        
            this.axios.post("News.php").then((res)=>{
                if(res.data.errCode=='1'){
                    _this.news=JSON.stringify(res.data.news)
                    localStorage.setItem('news',JSON.stringify(res.data.news))
                }
            })
        }

news is worthy of change

Suddenly I found that the DOM was updated, but the Swipe plug-in was not running normally.

I keep solving problems that I don’t have, and I’m drunk.

習慣沉默
習慣沉默

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!