当前位置: 首页 > 工具软件 > X-TRACK > 使用案例 >

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

益楷
2023-12-01
            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);
            });

 

 类似资料: