vue 的axios请求数据2种方式 很重要



show:function(){
                //post 方式
                //赋值给变量self   //使用axios  请求后台的数据    get和post的两种方式
                var self=this;
                var url='xxxx.json';
                axios.post(url,{
                    params:{
                        username:"yyyyy",
                        password:'18888'
                    }
                }).then(function (response) {
                    console.log(response);
                }).catch(function (error) {
                    console.log(error);
                })
            },
            show: function(){
                //get方式
                //赋值给变量self
                var self = this;
                var url = "hotcity.js

你可能感兴趣的:(vue,前端技术,vue,axios请求数据的方法)