Vue+jquery . Send a request to update the data with $.ajax. the data has been updated, but the page has not changed.

problem description

vue+jquery. Send a request to update the data with $.ajax, the data has been updated, but the page has not changed

related codes

data: {
    myData:[];
}
methods:{
    get:function(){
        $.ajax({
            url: "http://XXXX",
            type: "GET",
            data:{},
            success: function(res){
            // console.log(res[1]);
            his.myData = res[1];
            console.log(this.myData);
            },
        })
    }
}
    
<ul>
    <li class="text-left" v-for="(item, index) of myData">{{item}}</li>
</ul>
<p class="text-info" v-show="myData.length == 0">...

result

result console.log (this.myData) has been updated, but the view has not been updated and still shows that there is no data yet

Feb.22,2022

the problem pointed to by this. The code is as follows:

 

his.myData = res [1];

Change

to
this.myData.push (.res [1])
pay attention to the context

Menu