Pass parameters in the delete request method in vue

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;
                    }
                });

Through repeated testing, it is found that when the delete request is made, params cannot be used to pass parameters, but data should be used.

Guess you like

Origin blog.csdn.net/XU441520/article/details/115298796