vue中deletet请求方式进行传参

let _this = this, queryParams = [];queryParams.push(_this.currentNodeId);_this.$refs[plantInfo].validate((valid) = {if (valid) {_this.loading = true;_this.$http.delete(/info/tprjinfo, {data: quer...

let _this = this, queryParams = [];
                queryParams.push(_this.currentNodeId);
                _this.$refs['plantInfo'].validate((valid) => {
                    if (valid) {
                        _this.loading = true;
                        _this.$http.delete('/info/tprjinfo', {
                            data: queryParams
                        }).then(({data: res}) => {  
                            if (res.code !== 0) {
                                _this.loading = false;
                                return _this.$message.error(res.msg);
                            }
                            _this.$message({
                                message: '站点删除成功!',
                                type: "success",
                                duration: 500,
                                onClose: () => {
                                    _this.visible = false;
                                    _this.getAllSites();
                                },
                            });
                            _this.loading = false;
                        }).catch((error) => {
                            console.log(res)
                        });
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });

通过反复测试发现:delete请求的时候不能用params传参,而要用data

本文标题为:vue中deletet请求方式进行传参

上一篇: VuePress

基础教程推荐