javascript - vue variable update cannot trigger dom update
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-06-12 09:29:44
0
10
981

As shown below, I use v-for to render this itemList in html, and control whether to display (v-show) the html corresponding to this item through the active of each item.
However, if the itemList is changed through the event method selectItem like this, the dom is not updated? ? ?

var vue = new Vue({
    el: '#app',
    data: {
        itemList:{
            '1':{'text':'abc', 'active':false},
            '2':{'text':'abc', 'active':true}
         },
    },
    methods: {
        selectItem: function (index) {
            vue.itemList[index].active = true;
        },
        
    },
});
女神的闺蜜爱上我
女神的闺蜜爱上我

reply all(10)
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!