javascript - The data will not be updated after the current page is liked. It will be updated after refreshing.
某草草
某草草 2017-05-19 10:16:01
0
4
495
zan:function (n){
                        this.$http({
                            url:URL,
                            data:{
                                act:'acc',
                                id:n
                            }
                        }).then(function(res){
                                 //这里怎么写,大胸弟....
                        });

                    },

某草草
某草草

reply all(4)
洪涛

After clicking, it’s not enough to change the displayed number. The variable used is the variable number + 1

巴扎黑

After the click event, add one to the number and then change the displayed number on the page. Either you write less or there is something wrong with the order of your writing

Peter_Zhu

After clicking, send a like request through ajax. If the request is successful, the number of likes will be updated. If the request fails, "Like Failed" will be displayed and the number will remain unchanged.

洪涛
zan:function (n){
                        this.$http({
                            url:URL,
                            data:{
                                act:'acc',
                                id:n
                            }
                        }).then(function(res){
                                 //这里怎么写,大胸弟....
                                 if(res.status === xx){
// vm.num  你绑定的数据 直接赋值                                  vm.num = res.data
                                 }
                        });

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