表单数据将空请求发送到服务器

问题描述

我正在使用vuejs和laravel为管理员创建一个面板 我知道没有表单数据我无法发送任何文件 所以我得像这样使用formData

onSubmit(evt) {
                evt.preventDefault();

                this.emptyValidator();

                let data = new FormData();
                console.debug(this.form)
                for (let input in this.form) {
                    data.append(input,this.form[input]);
                }
                data.append('image',this.image);
                console.debug(data)
                console.debug(this.image)
                ProductDataService.update(this.id,data)
                    .then(response => {
                        let data = response.data;
                        if (data.data) {
                            Swal.fire('edited successfully','','success');
                        }
                    })
                    .catch(error => {
                        if (error.response.status && error.response.status === 422)
                            this.handleValidation(error);
                    })

            },

注意:我正在生产模式下使用它

当我尝试在Laravel中dd时,它显示我为空

我在发送手册和表格数据方面没有任何问题,这让我很痛苦

as u can see formData.entries works fine

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)