Axios用Postman请求,使用x-www-form-urlencoded方式传输

            const params = new URLSearchParams();
            params.append('key', this.key);
            params.append('name', this.name);
            params.append('desc', this.desc);
            let _that = this;
            axios.post('https://tsapi.amap.com/v1/track/service/add', params,{
              headers:{
                'content-type': 'application/x-www-form-urlencoded'
              }
            })
            .then(function (res) {
                if(res.data.errcode == '10000'){
                    _that.reload();
                    _that.name = '';
                    _that.desc = ''; 
                }else{
                    _that.$Notice.warning({ title: res.data.errmsg});
                }
            }).catch(function (error) {
                console.log(error);
            });

 

你可能感兴趣的:(vue,vue,axios)